Data Sheet

17
code -> P04_Vibration_Motor -> init.lua. After the upload completed then click “Download
to download the init.lua file.
Demo code:
gpio.mode(1,gpio.OUTPUT) -- set port1 output mode
gpio.mode(2,gpio.INPUT) -- set port2 input mode
while(1) do
gpio.read(2)
tmr.delay(200000) --delay 2s
if (gpio.read(2)==1) then
gpio.write(1,gpio.HIGH)
end
if (gpio.read(2)==0) then
gpio.write(1,gpio.LOW)
end
end
When the tilt switch slope, the vibration motor vibrating. Otherwise, the vibration motor was
not vibrating.
Lesson5: Emergency Light
Do you want to design a emergency light, which can automatic working when the light
dimmed, and it will stop when the light brighter. So it can be used for emergency light system. In
this lesson, we will help you about this application.
Material:
Crowtail- ESP8266 NodeMCU x 1
Crowtail- Light Sensor x 1
Crowtail- LED x 1
Hardware Connection
Open the LuaLoader, click the “Upload File…” to cho ose ES P8266 NodeM CU kit demo
code -> P05_Emergency_Light -> init.lua. After the upload completed then click “Download to
download the init.lua file.