TGV1
December 24, 2016, 2:39pm
1
Hello,
I have the lights at home controlled by Arduino/Ethernet. The code always worked fine but, after a updated version of the code it is not working anymore. So I uploaded the previous version (which worked for more than 6 months) but this is not starting anymore.
The code stops at server.begin();
Does someone has an idea why it is not working anymore?
Is this an arduino problem or is this related the the ROUTER?
Thanks in advance, merry x-mas!
TGV1
December 24, 2016, 2:47pm
2
#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>
#include <RCSwitch.h>
#include <Wire.h>
#include "RTClib.h"
// size of buffer used to capture HTTP requests
#define REQ_BUF_SZ 100//60
// MAC address from Ethernet shield sticker under board
byte mac[] = { mac adress };
IPAddress ip(192, 168, 0, 177); // IP address, may need to change depending on network
EthernetServer server(80); // create a server at port 80
File webFile; // the web page file on the SD card
char HTTP_req[REQ_BUF_SZ] = {0}; // buffered HTTP request stored as null terminated string
char req_index = 0; // index into HTTP_req buffer
boolean LED_state[27] = {0}; // stores the states of the LEDs
int clientCount = 0;
void setup()
{
pinMode(12, OUTPUT);
digitalWrite(12, LOW); //RESET SCHAKELING
int hatimerReset = LOW;
// disable Ethernet chip
pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
Serial.begin(115200); // for debugging
// Start Serial to connect P1 Smart Meter
Serial1.begin(115200); //pin19 (rx)
Serial.println("**********BEGIN VOID SETUP**********");
// initialize SD card
Serial.println("Initializing SD card...");
if (!SD.begin(4)) {
Serial.println("ERROR - SD card initialization failed!");
return; // init failed
}
Serial.println("SUCCESS - SD card initialized.");
// check for index.htm file
if (!SD.exists("index.htm")) {
Serial.println("ERROR - Can't find index.htm file!");
return; // can't find index file
}
Serial.println("SUCCESS - Found index.htm file.");
///////////////////
Serial.println("Ethernet starting...");
Ethernet.begin(mac, ip); // initialize Ethernet device
Serial.println("..."); ------------------- LAST LINE PRINTED IN SERIAL MONITOR ------------------
server.begin(); // start to listen for clients
Serial.println("...Ethernet started");
Serial.println("**********EINDE VOID SETUP**********");
} // einde void setup
VOID LOOP
Which ethernet device are you using? Which library?
TGV1
December 24, 2016, 3:16pm
4
Hi,
I am using an Arduino Mega 2560 with ethernet shield 2
Ethernet library version 1.1.2
I will guess it is your ethernet library. Where did you get the library?
TGV1
December 24, 2016, 3:38pm
6
The Arduino IDE updated the library via the 'automatic updates'. Where can I find older versions of libraries?
I use the ethernet library from WIZnet. If you do the library update as suggested by the IDE popup window, it will overwrite the new library with an original w5100 version. If you are using a w5200 or w5500 ethernet controller, it will cause that fail.
TGV1
December 24, 2016, 4:43pm
8
Thanks for the support SurferTim. Installing the WIZnet library made the code work