LCD ESP8266WiFi 接入点 发送文本

发布于 2025-01-18 15:44:20 字数 1917 浏览 1 评论 0原文

你好,我正在尝试将数据发送到液晶屏 ,但它们以 GET/ DATO /HTTP 1.1 的形式到达

我只需要到达数据并删除 (GET/ /HTTP 1.1)

我习惯了 esp8266 在接入点模式下通过 wifi 程序运行良好

请求是到达的数据arduino终端

  }
 if (request.indexOf("") != -1)  { //////SHIPPING PART
  // enviar
  lcd.init();
   lcd.backlight();
   lcd.setCursor(0,0);
   lcd.print(request);

    delay(1000);
 
   }

发送文本

我只想发送文本,所以这就是我希望实现的

SEND DATO

DELETE GET/ /HTTP 1.1

#include <ESP8266WiFi.h>
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>



   
const char *ssid_AP = "LCDAP";
const char *Password_AP = "12345678";

WiFiServer server(80);

LiquidCrystal_I2C lcd(0x27,2,16); 

void setup(){
  lcd.init();                      // initialize the lcd 
  lcd.backlight();
  lcd.setCursor(2,0);
  lcd.print("LCD Ready");
  Serial.begin(115200);
  delay(10);


  delay(1000);
  WiFi.mode(WIFI_AP);
  WiFi.softAP(ssid_AP,Password_AP);

  Serial.println("WiFi conected");
  Serial.println();
  WiFi.printDiag(Serial);
  Serial.print("AP direccion IP: ");
  Serial.println(WiFi.softAPIP());

  // Start the server
  server.begin();
  Serial.println("Server started");
  
  }

void loop() {
  // Check if a client has connected
  WiFiClient client = server.available();
  if (!client) {
    return;
  }
 
  // Wait until the client sends some data
  Serial.println("new client");
  while(!client.available()){
    delay(1);
  }
 
  // Read the first line of the\r %d\n
  String request = client.readStringUntil('\n');
  Serial.println(request);
  client.flush();

 

if (request.indexOf("/LCDBORRAR") != -1)  {
   lcd.clear();
    delay(1000);
 
  }
 if (request.indexOf("") != -1)  { ////// send text
  // enviar
  lcd.init();
   lcd.backlight();
   lcd.setCursor(0,0);
   lcd.print(request);

    delay(1000);
 
   }
 
 
  delay(1);
  Serial.println("Client disonnected");
  Serial.println("");

   }

hello i am trying to send data to lcd screen
,but they arrive as GET/ DATO /HTTP 1.1

I ONLY NEED TO ARRIVE DATA AND DELETE (GET/ /HTTP 1.1)

I am used to the esp8266 by wifi in access point mode the program works well

request is the data that arrives at the arduino terminal

  }
 if (request.indexOf("") != -1)  { //////SHIPPING PART
  // enviar
  lcd.init();
   lcd.backlight();
   lcd.setCursor(0,0);
   lcd.print(request);

    delay(1000);
 
   }

Send Text

I just want to send text so this is what I hope to ahieve

SEND DATO

DELETE GET/ /HTTP 1.1

#include <ESP8266WiFi.h>
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>



   
const char *ssid_AP = "LCDAP";
const char *Password_AP = "12345678";

WiFiServer server(80);

LiquidCrystal_I2C lcd(0x27,2,16); 

void setup(){
  lcd.init();                      // initialize the lcd 
  lcd.backlight();
  lcd.setCursor(2,0);
  lcd.print("LCD Ready");
  Serial.begin(115200);
  delay(10);


  delay(1000);
  WiFi.mode(WIFI_AP);
  WiFi.softAP(ssid_AP,Password_AP);

  Serial.println("WiFi conected");
  Serial.println();
  WiFi.printDiag(Serial);
  Serial.print("AP direccion IP: ");
  Serial.println(WiFi.softAPIP());

  // Start the server
  server.begin();
  Serial.println("Server started");
  
  }

void loop() {
  // Check if a client has connected
  WiFiClient client = server.available();
  if (!client) {
    return;
  }
 
  // Wait until the client sends some data
  Serial.println("new client");
  while(!client.available()){
    delay(1);
  }
 
  // Read the first line of the\r %d\n
  String request = client.readStringUntil('\n');
  Serial.println(request);
  client.flush();

 

if (request.indexOf("/LCDBORRAR") != -1)  {
   lcd.clear();
    delay(1000);
 
  }
 if (request.indexOf("") != -1)  { ////// send text
  // enviar
  lcd.init();
   lcd.backlight();
   lcd.setCursor(0,0);
   lcd.print(request);

    delay(1000);
 
   }
 
 
  delay(1);
  Serial.println("Client disonnected");
  Serial.println("");

   }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花开半夏魅人心 2025-01-25 15:44:21

req.replace(" HTTP/1.1", ""); // 退出 HTTP/1.1
req.replace("GET /", ""); // 取消 GET /

req.replace(" HTTP/1.1", ""); // Para quitar HTTP/1.1
req.replace("GET /", ""); // Para quitar GET /

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文