text From Client Browser To i2c LCD ESP 8266


im starting project using web browser send simple text string esp i2c lcd , googled see if can save time kept getting errors on compiling
i found post
startingelectronics.org/tutorials/arduino/web-page-to-lcd

it looks good, need, don't wish use sd card simple project, want store sd card file hold in variable called text_display

i want work access point , have ability accessed through routers ap, commenting out line can hide stand alone ap , use routers ap (iv done before couple years ago)

so sum connect esp client greeted simple form input 2 lines of text , value stored var outputting i2c lcd, im stuck on compiling, here 1 example failed...


// (c) j~net
#include <esp8266wifi.h>
#include <wificlient.h>
#include <esp8266webserver.h>
#include <esp8266mdns.h>
#include <wire.h>
#include <liquidcrystal_i2c.h>
liquidcrystal_i2c lcd(0x38, 16, 2);

// #define oled_reset 4

const char* ssid = "routerap";
const char* password = "secretpass";

esp8266webserver server(80);

const int output1 = 14;
const int output2 = 12;
const int output3 = 13;
const int output4 = 15;

boolean device1 = false;
boolean device2 = false;
boolean device3 = false;
boolean device4 = false;

void handleroot() {
  //digitalwrite(led, 1);
  //server.send(200, "text/plain", "hello esp8266!");
  //digitalwrite(led, 0);

  string cmd;     
      cmd += "<!doctype html>\r\n";
      cmd += "<html>\r\n";
      //cmd += "<header><title>esp8266 webserver</title><h1>\"esp8266 web server control\"</h1></header>";
      cmd += "<head>";
      cmd += "<form action=\"/submit\">text display:<br><input type=\"text\" name=\"text_display\"><br></form>";
      cmd += "</head>";
     
      if(device1){
        cmd +=("<br/>device1  : on");
      }
      else{
        cmd +=("<br/>device1  : off");
      }
     
      if(device2){
        cmd +=("<br/>device2  : on");
      }
      else{
        cmd +=("<br/>device2  : off");
      }
           
       if(device3){
        cmd +=("<br/>device3  : on");
      }
      else{
        cmd +=("<br/>device3  : off");
      }
     
      if(device4){
        cmd +=("<br/>device4  : on");
      }
      else{
        cmd +=("<br/>device4  : off");
      }
           
      cmd += "<html>\r\n";
      server.send(200, "text/html", cmd);
}

void handlenotfound(){
  //digitalwrite(led, 1);
  string message = "file not found\n\n";
  message += "uri: ";
  message += server.uri();
  message += "\nmethod: ";
  message += (server.method() == http_get)?"get":"post";
  message += "\narguments: ";
  message += server.args();
  message += "\n";
  (uint8_t i=0; i<server.args(); i++){
    message += " " + server.argname(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
  //digitalwrite(led, 0);
}

void setup(void){
  lcd.begin();
  lcd.backlight();
  lcd.print("please wait...");
 
  pinmode(output1, output);
  pinmode(output2, output);
  pinmode(output3, output);
  pinmode(output4, output);

  digitalwrite(output1, low);
  digitalwrite(output2, low);
  digitalwrite(output3, low);
  digitalwrite(output4, low);
   
  serial.begin(115200);
  wifi.mode(wifi_sta); // comment out line use router ap
  wifi.begin(ssid, password);
  serial.println("");


  // default, we'll generate high voltage 3.3v line internally! (neat!)
  //display.begin(ssd1306_switchcapvcc, 0x3d);      // initialize i2c addr 0x3d (for 128x64)

   

  delay(2000);


  // wait connection
  while (wifi.status() != wl_connected) {
    delay(500);
    serial.print(".");

  }
  serial.println("");
  serial.print("connected ");
  serial.println(ssid);
  serial.print("ip address: ");
  serial.println(wifi.localip());

 

  if (mdns.begin("esp8266")) {
    serial.println("mdns responder started");
  }

  server.on("/", handleroot);

  server.on("/submit", handle submit);

  if (server.args() > 0 ) {
    ( uint8_t = 0; < server.args(); i++ ) {
      if (server.argname(i) == "text_display") {
         // here value server.arg(i);
         // output text serial console & lcd
         serial.println(text_display);
         lcd.print("text_display");

         
      }
   }
}

  server.onnotfound(handlenotfound);
  server.begin();
  serial.println("http server started");
}

void loop(void){
  server.handleclient();
}


please ignore outputs previous project mentioned years ago plan use @ later date , did not want strip out yet, ideas way appreciated?

quote
it looks good, need, don't wish use sd card simple project, want store sd card file hold in variable called text_display
in project linked to, sd card used hold page server serves up. if page small enough, , static enough, don't need store in file on sd card.

quote
here 1 example failed...
you did not tell compiler didn't like, unlikely you'll help.


Arduino Forum > Using Arduino > Project Guidance > text From Client Browser To i2c LCD ESP 8266


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts