在LUA中获取请求 - “>>”发送请求后

时间:2016-01-28 18:56:01

标签: lua esp8266 nodemcu

我通过Arduino IDE发送我的Lua代码。

我在Arduino的素描:

#include <SoftwareSerial.h>
SoftwareSerial ESPserial(2, 3); // RX | TX

void setup() 
{
    Serial.begin(9600);     // communication with the host computer
    //while (!Serial)   { ; }

    // Start the software serial for communication with the ESP8266
    ESPserial.begin(9600);  

    Serial.println("");
    Serial.println("Remember to to set Both NL & CR in the serial monitor.");
    Serial.println("Ready");
    Serial.println("");    
    delay(1000);
}

void loop() 
{
    // listen for communication from the ESP8266 and then write it to the serial monitor
    if ( ESPserial.available() ) {  Serial.write( ESPserial.read() );  }

    // listen for user input and send it to the ESP8266
    if ( Serial.available() ) {  ESPserial.write( Serial.read() );  }
}

我打开串口并发送我的代码:

conn=net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload) print(payload) end)
conn:connect(8080, "192.168.0.100")
conn:send("GET /json.htm?type=command&param=udevice&idx=3&nvalue=0&svalue=69 HTTP/1.1\r\nHost: 192.168.0.100\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n")

但我的ESP返回“&gt;&gt;”在最后一个命令之后.. there is screen enter image description here

当我更换conn时:发送此信息:

conn:send("GET / HTTP/1.1\r\nHost: 192.168.0.100\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n")

一切都是正确的,我从服务器回复......

感谢您的帮助!

0 个答案:

没有答案