Class: IoT::BinaryReceptor
- Defined in:
- lib/iot/binary_receptor.rb
Overview
BinaryReceptor - receptor/actuator with binary logic
Direct Known Subclasses
Instance Method Summary collapse
- #high? ⇒ Boolean
-
#initialize(pin = 21, pull = :up) ⇒ BinaryReceptor
constructor
A new instance of BinaryReceptor.
- #low? ⇒ Boolean
Methods inherited from Receptor
Constructor Details
#initialize(pin = 21, pull = :up) ⇒ BinaryReceptor
Returns a new instance of BinaryReceptor.
7 8 9 10 |
# File 'lib/iot/binary_receptor.rb', line 7 def initialize(pin=21, pull=:up) @pin = pin RPi::GPIO.setup pin, :as => :input, :pull => pull end |
Instance Method Details
#high? ⇒ Boolean
12 13 14 |
# File 'lib/iot/binary_receptor.rb', line 12 def high? RPi::GPIO.high? @pin end |
#low? ⇒ Boolean
16 17 18 |
# File 'lib/iot/binary_receptor.rb', line 16 def low? RPi::GPIO.low? @pin end |