Class: BBB::Components::AnalogComponent
- Inherits:
-
Object
- Object
- BBB::Components::AnalogComponent
- Includes:
- Pinnable
- Defined in:
- lib/BBB/components/analog_component.rb
Overview
An AnalogComponent is a component that reads from an analog input (AIN) on the board. You can use a generic analog component for, for example, temperature or light sensors.
The BeagleBoneBlack has 12 bit (4096) AIN pins. So the expected value of an analog pin is between 0 and 4096.
Instance Attribute Summary
Attributes included from Pinnable
Instance Method Summary collapse
-
#pin ⇒ Object
Convenience method to grab the first pin in the pins array.
-
#read ⇒ Object
Read from an initialized pin, if the pins have not been initialized yet, this method might actually raise an exception.
- #value ⇒ Object
Methods included from Pinnable
#after_pin_initialization, included, #initialize_pins, #pinnable?, #verify_pin_position_count
Instance Method Details
#pin ⇒ Object
Convenience method to grab the first pin in the pins array
40 41 42 |
# File 'lib/BBB/components/analog_component.rb', line 40 def pin pins.first end |
#read ⇒ Object
Read from an initialized pin, if the pins have not been initialized yet, this method might actually raise an exception.
24 25 26 |
# File 'lib/BBB/components/analog_component.rb', line 24 def read pin.read end |
#value ⇒ Object
31 32 33 |
# File 'lib/BBB/components/analog_component.rb', line 31 def value read end |