Categories

Tutorial

LED Blinking using ESP8266 by LUA

Robo India presents tutorial on LED blinking on ESP8266 wifi module by LUA.

Detailed Tutorial

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.

LED-blinking-esp8266-2

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 info@roboindia.com

our whatsapp helpline: whatsapp-logo-robo-india +91 9694011188

Thanks and Regards
Content Development Team
Robo India
http://roboindia.com

Related Tutorials
Logic Level Converter

Robo India presents tutorial how to use logic level converter. While interfacing with sensor or other electronic device logic level converter is required, if one device works on 5V and other on 3.3V and both have to communicate than this logic level converter will be required between them.

ESP8266 Wiif Module Setup

Robo India presents tutorial how to setup ESP8266 wifi module. Hardware configuration to run ESP 8266 wifi module is explained in this tutorial.

ESP8266 Flash with NodeMCU firmware

Robo India presents tutorial how to flash ESP8266 wifi module with LUA firmware. NodeMCU firmware is used here.

Starting with LUA on ESP8266 Wifi module

Robo India presents tutorial on starting with LUA on ESP8266 wifi module and ESPLORER.

Robo India Tutorial portal

Illustrated tutorials and guides.

Feel free to contact us

© Robo India | http://roboindia.com