About secret area

Latest update: July 2019

In this tutorial, we will show you how to place a script in the secret area of FlashAir and operate it from CONFIG.

Save the script in the hidden area

After setting the password with fa.control("hid_set_pass"), save it in the hidden area with fa.control("hid_store").

-- Password

-- Input file
filename_org = {

-- Input folder
foldername = "p:"


fa.control("hid_set_pass", password)

-- Send the file to the hidden area
for i,v in ipairs(filename_org) do
	send_name = foldername..v
	fa.control("hid_store", send_name, password)

Execute the secret area script

It is possible to execute the secret area script by describing it in SD_WLAN/CONFIG as follows.


How to use sample code

By using the sample code, it is possible to set the script in the hidden area and set up CONFIG. Place the test.lua in FlashAir's root directory as a sample that executes the script installed in the secret area, setting.lua setting the password and input file, input folder, and sample.

Copy SD_WLAN/CONFIG and create a file named SD_WLAN/_CONFIG.

Add the following to SD_WLAN/CONFIG and set it to execute the script at startup.


In order to execute test.lua saved in hidden area, set SD_WLAN/_CONFIG as follows.


By plugging in and unplugging FlashAir, the script is saved in the secret area. There is no problem if test.lua and setting.lua, SD_WLAN/_CONFIG are deleted. After about 10 seconds elapse, the script saved in the hidden area is executed by inserting and removing FlashAir again.

When you connect to FlashAir from a web browser, test.lua is executed and you can confirm that Hello.txt is created in the root folder.

In setting.lua, after saving the script in the secret area, it is read from the secret area and compare is done. If the compare fails, the script stops there. Indicates the source code of the relevant part.

-- Read and compare the file in the secret area
for i,v in ipairs(filename_org) do
	hid_name = hid_drv..v
	comp_name = foldername..add_name..v
	org_name = foldername..v
	-- Read from confidentiality and compare
	fa.control("hid_get", hid_name, comp_name, password)
	ret = compfile(org_name, comp_name)
	-- If the contents are wrong, stop there
	-- If it is correct, erase the writing file and the compare file
	if ret ~= true then
		print(v.." is hidden write fail...")
		print(v.." is OK")
		-- Delete compare file
		-- Delete original file

-- Delete CONFIG file

-- Rename the CONFIG file
fa.rename("p:SD_WLAN/_CONFIG", "p:SD_WLAN/CONFIG")

Sample code

advanced_tutorial_09.zip (4KB)

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