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
In this example an AM412 is attached to GPIO26. Sensor changes are processed using a callback:
s=sensor.attach("AM412", pio.GPIO26)
s:callback(
function(magnitude)
if (magnitude["presence"] ==1) thenprint("somebody in area")
elseprint("nobody in area")
endend
)
In this example an AM412 is attached to GPIO26. Sensor changes are processed using an infinite loop:
s=sensor.attach("AM412", pio.GPIO26)
whiletruedoif (s:read("presence") ==1) thenprint("somebody in area")
elseprint("nobody in area")
endend