forked from whitecatboard/Lua-RTOS-ESP32
-
Notifications
You must be signed in to change notification settings - Fork 0
TILT SWITCH
Thomas E. Horner edited this page Mar 12, 2019
·
6 revisions
What | Comments | |
---|---|---|
Identifier | TILT_SWITCH | |
Interface | GPIO | |
Provides | on | 1 = switch active 0 = switch inactive |
Properties | none | |
Callbacks? | yes | |
Datasheet |
- Hardware pull-ups are not required for switch.
-- Attach a tilt switch to GPIO26
s = sensor.attach("TILT_SWITCH", pio.GPIO26)
-- Register a callback. Callback is executed when some sensor property changes.
s:callback(
function(data)
if (data.on == 1) then
print("on")
elseif (data.on == 0) then
print("off")
end
end
)