-1

I know when we buy a NodeMCU, we get the NodeMCU firmware already installed in it. But how come we are able to use the Arduino IDE (used for C++ programming) with this dev kit?

How can we use a C++ IDE to work with a Lua-based firmware? What's wrong with my concepts here?

dda
  • 6,030
  • 2
  • 25
  • 34
abhi
  • 3,110
  • 1
  • 15
  • 17

1 Answers1

5

"Lua based firmware" is a bit misleading as the core firmware itself is written in C (so is the Lua interpreter btw).

Checkout it's source code https://github.com/nodemcu/nodemcu-firmware

The nodeMCU firmware is erased and replaced by your Arduino sketch. You code it like any other Arduino.

You have to flash the NodeMCU firmware if you want to run Lua scripts on it again.

It's just two different pieces of software supporting the same micro controller.

Marcel Stör
  • 22,695
  • 19
  • 92
  • 198
Piglet
  • 27,501
  • 3
  • 20
  • 43
  • "The nodeMCU firmware is erased and replaced by your Arduino sketch" .. really ? just by uploading a program from Arduino IDE to my nodemcu? I did nothing else..are you sure firmware could be erased by just uploading program ? – abhi Nov 27 '17 at 13:36
  • 1
    @abhi what do you mean with "erased by just uploading a program"? what do you think happens when you upload a program? you overwrite the old program with the new one. nodemcu is replaced by your arduino sketch. you have a certain region in the microcontroller's memory that is for the program – Piglet Nov 27 '17 at 13:58
  • ahh.. could you please give me link to docs which could guide me to perform re-install of firmware and yes after that which IDE you recommend I should use to be able to start coding lua scripts and to upload them to my nodemcu.. sorry for these basic questions i'm new to this... thanks in advance ! – abhi Nov 27 '17 at 14:05
  • @abhi just use the Flash program that comes with NodeMCU https://nodemcu.readthedocs.io/en/master/en/flash/ I cannot recommend you anything as I do not know your requirements and personal preferences. in general it never hurts to learn more programming Languages. the more you know the easier it becomes. most professional programmers know at least 5-10 so why not learn Lua and see for yourself which way to go? – Piglet Nov 27 '17 at 14:13