11

I'm planning to buy an ESP8266. Do I really need to learn Lua to play with it? I have seen some people using it with the standard Arduino IDE.

Do you need a custom firmware to use the Arduino IDE instead of Lua?

The Arduino IDE seems better for me because I already know the syntax. Is there any downside to using the Arduino IDE instead of NodeMCU with Lua?

10

Using the Arduino IDE is custom firmware. That's what you're writing. You don't need any new firmware because the new firmware is what you are writing.

I can't think of any downsides to using C++ to program the ESP8266 instead of Lua - in fact it can only be a benefit since you are not using an interpreted language which is going to be slower than natively compiled code.

  • 3
    so why are most people using NodeMCU with Lua ? – n0tis Jan 26 '16 at 16:19
  • 3
    @n0tis Because it's pre-installed and very easy to use. Also they're told to use it when they buy it and don't know any better. – Majenko Jan 26 '16 at 16:19
  • 1
    @n0tis I have only ever programmed them in C++ and wouldn't do anything else. At the end of the day you can always re-install the LUA interpreter firmware and go back to LUA if you don't get on with the Arduino-style programming of it. Nothing is permanent - you can change your mind any time you like. – Majenko Jan 26 '16 at 16:22
  • 3
    It's Lua not LUA. It is not an acronym. See What's in a name?. How are you using Lua on the Arduino? – Nick Gammon Jan 26 '16 at 23:08
  • 2
    Yes, you just compile and upload. The lua firmware, or the AI thnker AT firmware are both just programs uploaded to the board: one to interpret Lua script, the other to interpret AT commands. Just like your Arduino sketches. – Majenko Jun 11 '16 at 19:18
10

Lua, like many scripting languages, tends to make you a lot more productive as a programmer: things become far easier as you work at a higher abstraction level and do not worry about trivial things like memory management. You achieve the same goals with far less lines of code. On the other hand, whereas it makes development faster, it also makes program execution slower. Whether this is a good trade-off or not is very dependent on the particular application you want to write.

In your particular case, you also have to consider the fact that you do not know Lua, and you already know both the C++ language and the Arduino API. Then you may not rip the benefits of Lua on a single project, because of the time needed to learn the language. You may consider learning the language as an investment, probably worth it if you are going to program a lot on this platform, probably not worth it if it's only for a single, simple enough project. If unsure, I suggest you take a look at the API provided with Lua on this platform: how well does it fit your project? Is it a significantly better fit than the Arduino API?

1

I STRONGLY RECOMMEND TO STAY WITH THE ARDUINO IDE!

Despite programming in C++ not being as friendly and versatile as Lua (working with Esplorer is really a dream come true!), Lua is VERY UNSTABLE AND UNPREDICTABLE!!!

You can run a simple program of ten lines and it works ok for a day... two... and suddenly, on the 3rd day the chip hangs unexpectedly, and with no reason! If you are lucky, the chip will reboot and program will start running again... that WAS NOT the case with me. I had to reload the program again! After 3 cycles like this, I decided to abandon Lua... FOREVER.

  • 2
    Same experience here. And I really, really liked Lua. – user31481 Nov 24 '17 at 14:43
  • Yeah. Lua as a language is an interesting experience. On NodeMCU, mostly a frustrating one.. – dda Nov 24 '17 at 15:09
  • 1
    I like lua and the REPL. I also like js on the ESP8266 (espruino) and its small footprint. As a programmer of embedded systems, it is very clear that many of the Arduino libraries are written by non-embedded programmers wasting and/or fragmenting valuable memory. I do use Arduino but do things like using my own string management from C rather than that ugly C++ class. Memory is a commodity to appreciate not abuse. – uDude Dec 18 '18 at 22:46
0

Sorry for bumping, but this thread helped me to decide for Arduino IDE.

I started with Arduino IDE but couldn't get it to work with ESP-07. Moved on to NodeMCU and Lua with Esplorer. Took me a while to get it working there also due to the odd bootloader baud rate. First it seemed so easy to set up a WEB-server, but problem was that all the examples found were based on an ancient FW 0.96, and trying with the latest 2.1 didn't work at all. So realising that people hadn't done much with newer FW gave me second thoughts.

Now with Arduino IDE things start to work the way they should! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.