class BBB::Pins::AnalogPin

A pin that reads from the ADC converteds on the board. On the Beaglebone this is AIN1 to 7. The class itself doesn’t do much, since most of the basic functionality is provided by the pinnable module which is included, as well as the IO::AIN object used for IO to the filesystem

Public Instance Methods

read() click to toggle source

Read from the Pin

@return Integer

# File lib/BBB/pins/analog_pin.rb, line 17
def read
  io.read
end
scale() click to toggle source

Return the scale of the Pin. On the BeagleBoneBlack 12 bit pins this is 4096.

@return Integer

# File lib/BBB/pins/analog_pin.rb, line 27
def scale
  @scale ||= io.scale
end

Private Instance Methods

default_io() click to toggle source
# File lib/BBB/pins/analog_pin.rb, line 33
def default_io
  IO::AIN.new(position)
end