Ciao a tutti,
scusate... ma non capisco dove è l'errore...
e pensare che in serial esce, ma su LCD no... GRRR.
eseguendo l'esempio LCD helloworld il mio circuito funziona bene, ma eseguendo quello qui sotto e collengandomici con telnet mi restituisce questo:
ed è strano perchè l'istruzioni del setup (ovvero lcd.print("192.168.0.188");
viene visualizzata... ma poi mi collego e quello che passo da telnet non va sebbene venga stampato correttamente nella serial.write! solamente che se lo direziono sull'LCD mi fa vedere quel casinello
dove sbaglio?
#include <SPI.h>
#include <Ethernet.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,0,188);
EthernetServer server(8888);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.setCursor(0, 1);
lcd.print("192.168.0.188");
delay(2000);
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
lcd.setCursor(1, 1);
lcd.print("test");
}
void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
lcd.print(c);
if (c == '\n') {
Serial.write("END LINE");
lcd.setCursor(1, 1);
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disonnected");
}
}
GRAZIE!!