-
Notifications
You must be signed in to change notification settings - Fork 234
AM412 PIR SENSOR
Thomas E. Horner edited this page Mar 12, 2019
·
4 revisions
| What | Comments | |
|---|---|---|
| Identifier | AM412 | ![]() |
| Interface | GPIO | |
| Provides | presence | 1 = somebody in area |
| 0 = nobody in area | ||
| Properties | none | |
| Datasheet |
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) then
print("somebody in area")
else
print("nobody in area")
end
end
)In this example an AM412 is attached to GPIO26. Sensor changes are processed using an infinite loop:
s = sensor.attach("AM412", pio.GPIO26)
while true do
if (s:read("presence") == 1) then
print("somebody in area")
else
print("nobody in area")
end
end
