An introduction to Lua on FlashAir

Latest update: March 2015

As of firmware version 3.00.00, FlashAir now supports Lua scripting!

In this tutorial series, we’ll learn step by step about the basics of the Lua scripting on FlahsAir.

What is Lua?

Lua is a fast, lightweight and powerful scripting language.

Lua and FlashAir

Lua on FlashAir opens up many new programming possibilities, and allows advanced features such as uploading files to external servers, downloading data, and dynamically generated HTML. Lua on FlashAir has some limitations. For information about these limitations as well as what libraries are available, please see the Lua API guide.

Prior Knowledge Required

Some familiarity with the Lua scripting language would be helpful, but isn’t necessary. If you’re looking to get started with the basics, there are Lua tutorials available here.


1. Development Tools

Any text editor will work for Lua programming, however there are some IDEs available if you wish to use one.

For more information, please visit the website .

To run your program, you will need to copy your script to the FlashAir card using a PC with an SD card slot (called an SD host device). Next you can either execute it with an http request (ie: http://flashair/myfile.lua from a web browser), or on boot/write events. See Part 2 for more details.

2. Get a FlashAir card!

The applications in this tutorial will require a FlashAir card. It can be purchased both online, and at electronics stores.

3. Supplemental Information

Using Station Mode
By default, the FlashAir works as a Wireless LAN Access Point (Infrastructure Mode). This means that while your machine is connected to the FlashAir, you won't be able to access Internet via Wireless LAN. However, if you have another Wireless LAN Access Point, FlashAir can work as a Wireless LAN Client (Station Mode). If you connect the FlashAir to a common Wireless LAN Access Point with your development environment, you can access both the FlashAir and Internet simultaneously. Please refer to Advanced Tutorial #1: Station Mode for more details.
Longer Timeout
FlashAir stop its Wireless LAN functionality to save the power consumption if no communication through Wireless LAN for some while. It is usual case in development phase. You can change the timeout length to stop Wireless LAN.

Please refer to CONFIG Reference: Set connection time-out period for more details.

All sample code on this page is licensed under BSD 2-Clause License