gpio.write(3, gpio.HIGH)
You can make this a little more automated by running a longer script.
For longer text, pasting can be difficult as the lua interpreter needs a little delay time
between characters and also require CR-LF settings. For that reason you may want to
paste each line and then hit return manually.
while 1 do
gpio.write(3, gpio.HIGH)
tmr.delay(1000000) -- wait 1,000,000 us = 1 second
gpio.write(3, gpio.LOW)
tmr.delay(1000000) -- wait 1,000,000 us = 1 second
end
The LED will now be blinking on and off.
Note that since its in a loop, its not possible to get it to stop via the interpreter. To
stop it, click the Reset button again!
This code halts the processor during the tmr.delay, a smarter way to blink an LED is to
use the timer capability to set off the LED control (code from here(https://adafru.it/
wGA))
-- Pin definition
local pin = 3
local status = gpio.LOW
local duration = 1000 -- 1 second duration for timer
-- Initialising pin
gpio.mode(pin, gpio.OUTPUT)
gpio.write(pin, status)
-- Create an interval
tmr.alarm(0, duration, 1, function ()
if status == gpio.LOW then
status = gpio.HIGH
else
status = gpio.LOW
end
gpio.write(pin, status)
end)
Scanning & Connecting to WiFi
We'll continue with a quick demo of scanning for WiFi and connecting.
Once you're back at the Lua prompt, set the ESP8266 into WiFi Client mode with
©Adafruit Industries Page 30 of 53