dev185
Newbie level 4
Hi all,
I am getting problem with my W5100 Ethernet shield interface with Arduino Mega 2560
I am getting localip address of my shield 255.255.255.255.
I have set the IP address of my shield at 192.168.0.50, gateway at 192.168.0.1,
subnet mask at 255.255.255.0. and used the library method Ethernet.begin(mac,ip,gateway,subnet) and called Serial.println(Ethernet.localipaddress()) method and the output as I mentioned (255.255.255.255)
please help me to sort this problem.
Thanks and regards,
Sayandev
- - - Updated - - -
My Code:-
I am getting problem with my W5100 Ethernet shield interface with Arduino Mega 2560
I am getting localip address of my shield 255.255.255.255.
I have set the IP address of my shield at 192.168.0.50, gateway at 192.168.0.1,
subnet mask at 255.255.255.0. and used the library method Ethernet.begin(mac,ip,gateway,subnet) and called Serial.println(Ethernet.localipaddress()) method and the output as I mentioned (255.255.255.255)
please help me to sort this problem.
Thanks and regards,
Sayandev
- - - Updated - - -
My Code:-
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 #include <SPI.h> #include <Ethernet.h> #include <utility/w5100.h> byte mac[] = { 0x80, 0xA2, 0xDA, 0x01, 0x59, 0x66 }; byte ip[] = { 192, 168, 0, 7 }; byte gateway[] = { 192, 168, 0, 157 }; byte subnet[] = { 255, 255, 255, 0 }; byte ipBuf[4]; char outBuf[18]; void setup() { Serial.begin(9600); pinMode(53,OUTPUT); digitalWrite(53,1); //Ethernet.begin(mac, ip, gateway, subnet); W5100.setIPAddress(ip); W5100.setSubnetMask(subnet); W5100.setGatewayIp(gateway); W5100.setMACAddress(mac); W5100.getIPAddress(ipBuf); //sprintf(outBuf,"%u.%u.%u.%u\r\n",ipBuf[0],ipBuf[1],ipBuf[2],ipBuf[3]); //Serial.println(Ethernet.localIP()); //Serial.println(outBuf); Ethernet.begin(mac, ip, gateway, subnet); delay(1000); } void loop() { Serial.println("Tick"); delay(1000); }
Last edited by a moderator: