Robo India presents tutorial on LED blinking on ESP8266 wifi module by LUA.
1. Introduction:
This tutorial explains how to use GIPO of ESP8266 using LUA framework.
1.1 Prerequisites:
1.1.1 Basics of ESPlorer and ESP8266: This tutorial explains basic of ESPlorer.
Connect RX and TX pins of ESP8266 module to the Serial Port of you computer, if you don’t have one in your computer, FTDI or CP2102 can be used.
2. Connections
Except basic connection of ESP8266 and FTDI you will need to connect one LED to GND through 1K resistance to one GPIO ( General Purpose Input Output ) pin of ESP8266. Here in this tutorial we are using GPIO13.
3. LUA Programme:
Connect ESP8266 Module to ESPlorer and transfer code by Coping and pasting the following code to ESPlorer User Window and click on Send to ESP button.
You may download this LUA file from here.
- Pin definition local pin = 7 -- GPIO13 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)
4. Explaining programme:
We are creating a timer of 1 second interval. Whatever is written in that timer that will be executed every second. We have written to make LED ON/OFF in that timer. Thus LED remains ON for 1 second and remains OFF of another one.
If you have any query please write us at support@roboindia.com
Thanks and Regards
Content Development Team
Robo India
http://roboindia.com