Hello Guys
I work on a project where I meassure the temperature and then send it to a webserver with my arduino.
I tried this whole setup with a arduino uno and a w5100 ethernetshiel where it worked perfect.
Now I want to get a bit more professionall and smaller so I decided to use a arduino nano and a mini enc28j60. Now I am at a point where I don't know my mistake. I saw that the connections depend on the libraries you use. I treid it with pin 8 and ethercard.h and now I am at pin 10 and UIPEthernet.h.
I think the problem is either at the connections or at the code/library.
I attached a picture of the plan how i connected everything.
And here's my code:
#include <UIPEthernet.h>
EthernetClient client;
IPAddress ip(192, 168, 0, 243);
byte mac[] = { 0x54, 0x34, 0x41, 0x30, 0x31, 0x31 };
// MAC in decimal{ 84, 52, 65, 48, 49, 49 };
char server[] = "192.168.0.184";
IPAddress dnsserver(192, 168, 0, 8);
void setup() {
Serial.begin(9600);
Ethernet.begin(mac, ip, dnsserver);
while(!Serial)
{
}
Serial.print("IP Address : ");
Serial.println(Ethernet.localIP());
Serial.print("Subnet Mask : ");
Serial.println(Ethernet.subnetMask());
Serial.print("Default Gateway IP: ");
Serial.println(Ethernet.gatewayIP());
Serial.print("DNS Server IP : ");
Serial.println(Ethernet.dnsServerIP());
}
void loop() {
int x = client.connect(server, 80);
if (x == 1) {
Serial.println("-> Connected");
client.print( "GET /add.php?");
client.print("temp=");
client.print( "12.3" );
client.println( " HTTP/1.1");
client.print( "Host: " );
client.println(server);
client.println( "Connection: close" );
client.println();
client.println();
client.stop();
Serial.println("Data sent. Waiting a bit to reconnect.");
}
else {
Serial.print("--> connection failed: ");
Serial.println(x);
}
delay(1000);
}
And if I just try to get the IP and so on by SHCP all I get is 0.0.0.0
Thank you for reading.