Data Sheet

20
Open the LuaLoader, click the “Upload File…”choo se ESP8 266 NodeM CU kit demo
code -> P08_Motion_detect -> init.lua. After the upload completed then click “Download to
download the init.lua file.
Demo code:
while(1) do
b=gpio.read(2)
print (b)
tmr.delay(2000000)
if(b==1) then
gpio.write(1,gpio.HIGH)
else
gpio.write(1,gpio.LOW)
end
end After successfully download the code, you will observed that: when there is a motive
object in the detection range of the sensor , the buzzer will alarm.
Lesson9: Hall Switch
In our daily life, we usually want to have an operation in certain situations, for example, the
conveyor belt transmission for a particular item to a location and then remove it, or the water
supply stop with the shower head back to the bracket when we are taking a shower, and so on. At
this moment we can place a hall sensor in a specific location of the conveyor belt, and place an
magnetic steel on the particular item package, so when the item is transferred to the specified
location it can realize automatic operation. Here is no conveyor belt, just one hall switch to
realize the automatic function.
Material:
Crowtail- ESP8266 NodeMCU x 1
Crowtail- Hall Sensor x1
Crowtail- Relay x1
Hardware Connection