#on? ⇒ Boolean

#pull!(state) ⇒ Object

When the pin has been initialized in input mode, internal resistors can be pulled up or down (respectively with :up and :down).

Pulling an input pin will prevent noise from triggering it when the input is floating.

For instance when nothing is plugged in, pulling the pin-up will make subsequent value readings to return 'on' (or high, or 1…). pin direction is set to :in. Either :up, :down or :offing. Defaults to :off.

# File 'lib/pi_piper/pin.rb', line 109defpull!(state)raisePiPiper::PinError,"Unable to use pull-ups : pin direction must be ':in' for this"if@direction!=:inand[:up,:down].include?(state)@pull=casestatewhen:upthenGPIO_PUD_UPwhen:downthenGPIO_PUD_DOWN# :float and :off are just aliases
when:float,:offthenGPIO_PUD_OFFelsenilendPlatform.driver.pin_set_pud(@pin,@pull)if@pull@pullend

#pull? ⇒ Boolean

If the pin direction is input, it will return the current state of pull-up/pull-down resistor, either :up, :down or :off.