The funny thing is after i posted my post on the forum, i tried one last pin config (a quite obvious one) and now it seems te be working
Just for the sake of science, here's some code:
#include <SPI.h>
#include <Ethernet.h>
#include <LiquidCrystal.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,105,177 };
byte gateway[] = { 192,168,105,254 };
byte subnet[] = { 255, 255, 255, 0 };
byte server[] = { 212,79,251,20 };
int port = 80;
boolean busy = false;
String output;
Client client(server, port);
int RS = 7;
int E = 6;
int D4 = 5;
int D5 = 4;
int D6 = 3;
int D7 = 2;
LiquidCrystal lcd(RS, E, D4, D5, D6, D7 );
void setup()
{
lcd.begin(16, 2);
lcd.setCursor(0,0);
lcd.print("INIT");
Ethernet.begin(mac, ip, gateway, subnet);
delay(1000);
}
void loop()
{
//Check the ethernet shield for data..
checkEthernet();
//Fetch time every 2 seconds..
if (!busy && millis() % 2000 == 0)
{
fetchTime();
}
}
void checkEthernet()
{
if (client.available())
{
char c = client.read();
output += c;
}
if (!client.connected() && busy)
{
client.stop();
lcd.setCursor(0, 1);
lcd.print("disconnected ");
int start = output.indexOf("{") + 1;
String t = output.substring(start, start + 8);
lcd.setCursor(0, 0);
lcd.print(t);
output = "";
busy = false;
}
}
void fetchTime()
{
busy = true;
lcd.setCursor(0, 1);
lcd.print("connecting ");
if (client.connect())
{
lcd.setCursor(0, 1);
lcd.print("connected ");
client.println("GET /tijd.php HTTP/1.0");
client.println();
}
else
{
lcd.setCursor(0, 1);
lcd.print("failed ");
busy = false;
}
}
I'm quite sure i tried pin 7 - 2 already :-/
Any ideas what could have gone wrong before?
I do see a lot of garbage on the LCD during flashing of the code to the Arduino.. Which pins are causing that?
cheers!
Matthijs