Hi,
just trying to make a simple WebClient connection to 'checkip.dyndns.org' and read the IP address and display it on my LiquidCrystal LED DIsplay...
I'm new in Arduino & CPP. I'm learning by doing.. have already a script which is doing what i need, but not 100% perfect. (btw. i know programming, but not cpp what i think is similar to perl, python, php, ect., so i can understand what you mayme mean in your answer..
)
My problem is, i can not display the output (char c = client.read(); on the LiquidCrystal as Text) ... here my code (btw. maybe cou can clean/make it beter?):
// include the library code:
#include <LiquidCrystal.h>
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
//IPAddress server(74,125,232,128);Â Â // numeric IP for example.com (no DNS)
char server[] = "checkip.dyndns.org";Â // name address for example.com (using DNS)
IPAddress ip(192,168,1,5);
// Initialize the Ethernet client library
EthernetClient client;
// initialize the LiquidCrystal with the numbers of the interface pins
LiquidCrystal lcd(9, 8, 5, 4, 3, 2);
void setup() {
 // set up the LCD's number of columns and rows:
 lcd.begin(16, 2);
 //lcd.setBrightness(20); //Doesn't work. Using Poti..
}
void loop() {
 // start the Ethernet connection:
 if (Ethernet.begin(mac) == 0) { Ethernet.begin(mac, ip); };
 delay(1000);
Â
 // Print a message to the LCD.
 lcd.clear();
 lcd.print("Connecting...");
Â
 // if you get a connection, report back via LiquidCrystal at bottom line:
 if (client.connect(server, 80)) {
  lcd.setCursor(0, 1);
  lcd.print("Connected...");
  // Make a HTTP request:
  client.println("GET / HTTP/1.1");
  client.println("Host: checkip.dyndns.org");
  client.println("Connection: close");
  client.println();
 }
 else {
  // kf you didn't get a connection to the server print it at LiquidCrystal:
  lcd.clear();
  lcd.print("Connection Error");
 }
 // If client connected, recieve data abd print it at LiquidCrystal and wait 5 sec.
 if (client.available()) {
  char c = client.read();
  lcd.clear();
  lcd.print(c); //ERROR IN HERE.. 'c' IS NOT A VALID STRING FOR LiquidCrystal
  delay(5000);
 }
 // if the server's disconnected, stop the client:
 if (!client.connected()) {
  lcd.clear();
  lcd.print("disconnecting.");
  //client.stop();
 }
 // wait 5 sec. to renew IP
 delay(5000);
}
/*
void lcdmsg( col, row, msg) {
lcd.clear();
lcd.setCursor(col, row);
lcd.print(msg);
}
*/
Hopy you can help me so i can learn more about CPP.
Thanks in advance.
Greetings from Germany,
Kris