ESP8266(Flased with nodemcu) and Arduino Uno ! HELP!

How do I run Lua script using Arduino IDE ? (Using an Arduino uno board as the serial provider for ESP8266)

(I am a complete newbie to microcontrollers and I am barely an intermediate level programmer)

I have an ESP8266 WIFI module (flashed with nodemcu) connected through my arduino uno . When I run the below code by sending it through the serial monitor it works just fine .

conn=net.createConnection(net.TCP, 0)
conn:on(“receive”, function(conn, payload) print(payload) end)
conn:send(“GET /devashishproject/index.php HTTP/1.1\r\n”)
conn:send(“Accept: /\r\n”)
conn:send(“User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n”)

When I try to add it to my code like below it just prints it onto the serial montior .

//SoftwareSerial ESP8266(1,0);

void setup() {
// put your setup code here, to run once:

void loop() {
// put your main code here, to run repeatedly:
Serial.println(“conn=net.createConnection(net.TCP, 0)”);
Serial.println(“conn:on(”“receive”", function(conn, payload) print(payload) end)");
Serial.println(“conn:send(”“GET /devashishproject/index.php HTTP/1.1\r\n”")");
Serial.println(“conn:send(”“Accept: /\r\n”")");
Serial.println(“conn:send(”“User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n”")");

how do I get it to execute these commands?

Hi, Could you solve the problem? I have just jump into MCU and trying to understand the commands, I see in your code that the command to conncect to your wifi is missing ( wifi.sta.config("SSID","PSWD"), as well as the command for station mode (wifi.setmode(wifi.STATION)). See that Serial.println("conn:send(""\r\n"")"); is not printing the same as we see, somehow we gotta make that be sent as a string and do not take action as a Serial.print return line. Check this one


try Serial.println("conn:send(\"\r\n\")");

PS: Still I can not work mine (send data to thingspeak), I am working on a stand alone LUA script that it kicks fine, just trying to do the same but with arduino.