-->
Page 1 of 2

Reading LUA file in Arduino IDE

PostPosted: Fri Nov 20, 2015 8:55 pm
by WalfasProject8
I have an issue loading a lua script programmed into an ESP via ESPlorer. I want to load it, first on the serial monitor, and then load it into an Arduino sketch.

Here's the code when I try to load the program on serial monitor:

Code: Select all#include <SoftwareSerial.h>

const byte rxPin = 3; // Wire this to Tx Pin of ESP8266
const byte txPin = 2; // Wire this to Rx Pin of ESP8266

// We'll use a software serial interface to connect to ESP8266
SoftwareSerial ESP8266 (rxPin, txPin);

void setup() {
  Serial.begin(9600);
  ESP8266.begin(9600); // Change this to the baudrate used by ESP8266
  delay(2000); // Let the module self-initialize
}

void loop() {
  while (Serial.available()){
     String Data = ESP8266.readStringUntil('\n');
     ESP8266.println(Data);
  } 
  while (ESP8266.available()){
     String inData = ESP8266.readStringUntil('\n');
     Serial.println("Got reponse from ESP8266: " + inData);
  } 
}


When I run this, I go to serial monitor and I write "dofile('server.lua')". It should show the IP of the ESP module, but it shows nothing at all. I already checked the baudrate of the serial monitor. Any help is aprecciated

Re: Reading LUA file in Arduino IDE

PostPosted: Fri Nov 20, 2015 10:36 pm
by Mmiscool
I am a bit confused here. You can't run lua scripts from inside the arduino environment.

Arduino environment allows you to create truly compiled applications. You upload to the esp by fully re-flashing the module.

Re: Reading LUA file in Arduino IDE

PostPosted: Fri Nov 20, 2015 11:01 pm
by WalfasProject8
So...an idea I've got is that I need to load an 'init' file onto the ESP when I do the 'doFile' in order to start the program, then do everything else into the Arduino, am I correct?

Re: Reading LUA file in Arduino IDE

PostPosted: Fri Nov 20, 2015 11:03 pm
by WalfasProject8
Because what I'm trying to do is a TCP server that when it recieves a data, the arduino will show a message throuh an LCD screen