Hi
I am new to Arduino coding although I have done a fair bit of C# and Python over the years as well as Html and Javascript so I have an understanding of the code, but this problem has me stumped without the debuging I am used to.
I have an Arduino Mega 2560 Rev3 with an Ethernet Sheild Rev3 compatable and my code is as follows
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte dns[] = {8, 8, 8, 8};
byte ip[] = {192, 168, 1, 3};
byte gateway[] = {192, 168, 1, 254};
byte subnet[] = {255, 255, 255, 0};
EthernetServer server = EthernetServer(80);
#define Led 52
void setup() {
// put your setup code here, to run once:
//Ethernet.begin(mac, ip, dns, gateway, subnet);
//server.begin();
pinMode(Led , OUTPUT);
}
void loop() {
digitalWrite(Led , HIGH);//turn the LED On by making the voltage HIGH
delay(500); // wait half a second
digitalWrite(Led , LOW);// turn the LED Off by making the voltage LOW
delay(500);
}
The above code works as expected and the Led flashes however if I uncomment this line of code
Ethernet.begin(mac, ip, dns, gateway, subnet);
the led will not work it just does nothing, I have also tried
Ethernet.begin(mac, ip, gateway, subnet); same result.
If I add code to access the web page at 192.168.1.3 everything works fine and I can print the result of commands I send to be executed but
digitalWrite(Led , HIGH);
will not switch the Led either HIGH or LOW when I send the command to the web page to switch the led with this line of code,
Ethernet.begin(mac, ip, gateway, subnet);
uncommented which of course needs to be included to be able to comunicate with the Arduino via ethernet.
Thanks in advance any help is much appreciated.
Neil