You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thomas E. Horner edited this page Mar 12, 2019
·
7 revisions
Specification
What
Comments
Identifier
HALL_SWITCH
Interface
GPIO
Provides
on
1 = switch active 0 = switch inactive
Properties
none
Callbacks?
yes
Notes
Hardware pull-ups are not required for switch.
Code
-- Attach switch to GPIO26s=sensor.attach("PUSH_SWITCH", pio.GPIO26)
-- Register a callback. Callback is executed when some sensor property changes.s:callback(
function(data)
if (data.on==1) thenprint("on")
elseif (data.on==0) thenprint("off")
endend
)