Data Sheet
16
Open the LuaLoader, click the “Upload File…”choo se ESP8 266 NodeM CU kit demo
code -> P03_ Moisture_sensor -> init.lua. After the upload completed then click “Download ”
to download the init.lua file.
Demo code:
while(1) do
b=adc.read(0) -- analog read A0
print (b)
tmr.delay(2000000) --delay 2s
end
you can see the sensor value in the LuaLoader debug window.
Lesson4: Vibration Motor
Tilt Switch is the equivalent of a button, it can output different signal when it upright and tilt.
In this lesson, we will learn how to control the vibration motor by the tilt switch. When the tilt
switch is slant, the vibration motor will be vibrating.
Material:
Crowtail- ESP8266 NodeMCU x 1
Crowtail- Vibration Motor x 1
Crowtail- Tilt Switchx 1
Hardware Connection
Open the LuaLoader, click the “Upload File…” to cho ose ES P8266 NodeM CU kit demo