Skip to content
Thomas E. Horner edited this page Mar 12, 2019 · 4 revisions

Specification

What Comments
Identifier AM412
Interface GPIO
Provides presence 1 = somebody in area
0 = nobody in area
Properties none
Datasheet

Code

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

Back to sensor list

Clone this wiki locally