Skip to content

HALL EFFECT SWITCH SENSOR

Thomas E. Horner edited this page Mar 12, 2019 · 5 revisions

Specification

What Comments
Identifier HALL_SWITCH
Interface GPIO
Provides on 1 = switch active
0 = switch inactive
Properties none
Callbacks? yes
Datasheet

Code

-- Attach a hall effect switch is attached to GPIO26
s = sensor.attach("HALL_SWITCH", pio.GPIO26)

s:callback(
   function(data)
      if (data.on == 1) then
         print("on")
      elseif (data.on == 0) then
         print("off")
      end
   end
)

Back to sensor list

Clone this wiki locally