1. sayfa
Kullandığınız kodları doğrudan paylaşırsanız daha iyi yardımcı olunabilir. |
lucky16 paylaşim usta hemen orjinal kodlar diye gerek duymadım açıkçası ama üzerinde degişiklik yapılmış olabilir // Present a "Will be back soon web page", as stand-in webserver. // 2011-01-30 <jc@wippler.nl>http://opensource.org/licenses/mit-license.php #include <EtherCard.h> #define STATIC 1 // set to 1 to disable DHCP (adjust myip/gwip values below) #if STATIC // ethernet interface ip address static byte myip[] = { 192,168,1,200 }; // gateway ip address static byte gwip[] = { 192,168,1,1 }; #endif // ethernet mac address - must be unique on your network static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 }; byte Ethernet::buffer[500]; // tcp/ip send and receive buffer const char page[] PROGMEM = "HTTP/1.0 503 Service Unavailable\r " "Content-Type: text/html\r " "Retry-After: 600\r " "\r " "<html>" "<head><title>" "Service Temporarily Unavailable" "</title></head>" "<body>" "<h3>This service is currently unavailable</h3>" "<p><em>" "The main server is currently off-line.<br />" "Please try again later." "</em></p>" "</body>" "</html>" ; void setup(){ Serial.begin(57600); Serial.println(" [backSoon]"); if (ether.begin(sizeof Ethernet::buffer, mymac) == 0) Serial.println( "Failed to access Ethernet controller"); #if STATIC ether.staticSetup(myip, gwip); #else if (!ether.dhcpSetup()) Serial.println("DHCP failed"); #endif ether.printIp("IP: ", ether.myip); ether.printIp("GW: ", ether.gwip); ether.printIp("DNS: ", ether.dnsip); } void loop(){ // wait for an incoming TCP packet, but ignore its contents if (ether.packetLoop(ether.packetReceive())) { memcpy_P(ether.tcpOffset(), page, sizeof page); ether.httpServerReply(sizeof page - 1); } } |
Modülden çıkan ethernet kablosunu nereye bağlıyorsunuz? Modem, switch vs. ise gateway ve IP uyusuyor mu? Mesela sizin gateway 192.168.2.1 olabilir. Bu durumda IP'yi de 192.168.2.200 vs. yapmanız gerek. Direkt bilgisayara bağlıyorsanız manuel IP almanız gerek bilgisayardan. Serial port'tan programın verdiği hataları okuyun yine ona göre hiç hata yoksa yukarıdaki adımları uygulayın. |
Modeme takiyorum 192.168.1.1 ip adresi Program da sadece dns adresinin gelmedigini gordum ip yi veriyor ve 192.168.1.1 e baglanjyor sorun dns gibi geldi bana |
Ben istemci için bunları yapıyordum. static byte dnsip[] = {8,8,8,8}; ether.copyIp(ether.dnsip, dnsip); Programdaki asağıdaki satırdan sonra yukaridakileri yazmayi deneyin denemediyseniz. #if STATIC ether.staticSetup(myip, gwip); |
Peki ustam aciklama satiririn altindaki kodu siliyormuyuz ondan sonrayami yapistircaz onceyemi geri siz mesaj atana kadar denemis olurum buyuk ihtimal le ama baska arkadaslarda yararlansin |
arkadaşım aynı sorunu bende yaşadım dns ile internet ayarlarınız ile ilgisi yok sorun şu enc28j60 kütüphanesi CS pin 8 olarak kullanır büyük ihtimalle sizde öyle yapmışsınız ama bunu kod içinde belirtmeniz lazım örnek if (ether.begin(sizeof Ethernet::buffer, mymac, 8) == 0) burada CS pin içib 8 taktıgınızı belirtmelisiniz. UUPEthernet == kütüphanesi ise CS pin 10 kullanır yani bu kütüphaneyi kullanıyorsanız CS pini 8 yerine 10 takın Ethershield == kütüphaneside CS pin 10 kullanır. EtherCard Kütüphane [/link] UUPEthernet Kütüphane [link=https://github.com/ntruchsess/arduino_uip] örnek arduino kod //---------------------------- #include <EtherCard.h> // ethernet interface mac address, must be unique on the LAN static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 }; static byte myip[] = { 192,168,1,103 }; byte Ethernet::buffer[500]; BufferFiller bfill; void setup () { if (ether.begin(sizeof Ethernet::buffer, mymac, 8) == 0) //CS pin 8 kullandıgını belirtelim Serial.println( "Failed to access Ethernet controller"); ether.staticSetup(myip); } static word homePage() { long t = millis() / 1000; word h = t / 3600; byte m = (t / 60) % 60; byte s = t % 60; bfill = ether.tcpOffset(); bfill.emit_p(PSTR( "HTTP/1.0 200 OK\r\n" "Content-Type: text/html\r\n" "Pragma: no-cache\r\n" "\r\n" "<meta http-equiv='refresh' content='1'/>" "<title>RBBB server</title>" "<h1>$D$D:$D$D:$D$D</h1>"), h/10, h%10, m/10, m%10, s/10, s%10); return bfill.position(); } void loop () { word len = ether.packetReceive(); word pos = ether.packetLoop(len); if (pos) // check if valid tcp data is received ether.httpServerReply(homePage()); // send web page data } //------------------------------------------------------------------ |
Cok tesekkur ederim suan disaridayim eve gecince hemen deneyecegim |
malesef olmadı arkadaşlar |
Arkadaslar nasil halledebilirim ben bu konuyu yardim edermisiniz |
arkadaşım benim düşünceme göre bi yerde hata yapıyorsun benim soledigim şekilde yaptıysanız çalışması lazım verdigim kutuphane dosyasını indirip denedinizmi ve kod içerisinde kendi IP numarana göre degiştirmeyi unutma |
Seri konsolda hata almıyorsanız kullandığınız internet tarayıcı ile alakalı bir sorun olabilir. Diğer örnekleri @conax'ın dediği gibi portu belirterek deneyin, default örnekler bende de çalışmıyordu sanırım port nosunu belirtmeden. |
ENC SO -> Arduino pin 12 ENC SI -> Arduino pin 11 ENC SCK -> Arduino pin 13 ENC CS -> Arduino pin 8 (yada 10, Kütühhaneye göre) ENC VCC -> Arduino 3V3 pin ENC GND -> Arduino Gnd pin Arduino Mega için SO 50 (MISO) SI 51 (MOSI) CLK 52 (SCK) CS 53 (SS) CS 10. pine takın UIPEthernet kutuphane kullanın burdan örnek bir kod yazdırıp deneyin https://github.com/ntruchsess/arduino_uip |
hocam verdiginiz link kırık gitmiyor linke 2 attıgınız girdim indirdim deniyorum şuanda |
1. sayfa
yardım edermisiniz