In this example we simple flash an LED connected to a nodemcu (esp8266) board. We will use lua for this example.
You will need a NodeMCU board, an led and a resistor, some connecting wire and if you are using components a breadboard makes life easier, I use combined LEDs and resistors on small modules which greatly simplify things removing the need of the breadboard
Layout
The layout assumes the use of a breadboard, I have chosen a 470 ohms resistor
Code
Save this as ledflash.lua and load it via the ESPlorer, video underneath shows this
[codesyntax lang=”lua”]
LED_PIN = 1 gpio.mode(LED_PIN, gpio.OUTPUT) value = true tmr.alarm(0, 500, 1, function () gpio.write(LED_PIN, value and gpio.HIGH or gpio.LOW) value = not value end)
[/codesyntax]
Video
The video shows me using the ESPlorer tool to connect to the NodeMCU board, open my lua file and then upload to my NodeMCU board