This is what i have for now:
#include <WString.h>
#include <Ethernet.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(9, 8, 5, 4, 3, 2);
byte mac[] = { 0x00, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 2, 150 };
Server server(80);
String readString = String(50);
void setup(){
Serial.begin(9600);
Ethernet.begin(mac, ip);
lcd.begin(16, 2);
lcd.print("setup running");
}
void loop(){
Client client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (readString.length() < 50){
readString.append(c);
}
if (c == '\n') {
if(readString.contains("msg")){
lcd.clear();
// get msg form get command!
// really need help here
lcd.print("blabla");
}
// Now output HTML data starting with standart header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
client.println("<html><head><title>arduino msg board</title></head><body><center>");
client.println("<form method=get>");
client.println("<input type=text name=msg>");
client.println("<input type=submit value=verstuur>");
client.println("</form>");
client.println(readString);
client.println("</center></body></html>");
readString="";
client.stop();
}
}
}
}
}
// EOF *******************************
I can't get the msg out of the string.
I tried using this:
char end_value = readString.length();
String msg1 = readString.substring(10, end_value - 11);
but it returns nothing...
very annoying...
have confirmed the lcd and ethernet shield working so that aint the problem...