Struct libbeaglebone::adc::ADC [] [src]

pub struct ADC { /* fields omitted */ }

Represents a pin configured as an ADC.

Methods

impl ADC
[src]

Creates a new ADC object.

Reads the raw voltage of the ADC.

Examples

use libbeaglebone::adc::ADC;

// Create a new ADC pin using ADC #0 and no scaling factor.
let mut sensor = ADC::new(0, 0.0);

// Read the ADC value.
sensor.read().unwrap();

Reads the raw voltage of the ADC and applies a scaling factor to it.

Useful for converting from a raw voltage to the actual unit measured by a sensor. For example, raw voltage -> degrees Celsius for a temperature sensor might have a scaling factor of 0.0122.

Examples

use libbeaglebone::adc::ADC;

// Create a new ADC pin using ADC #6 and a scaling factor of 0.0122.
let mut sensor = ADC::new(6, 0.0122);

// Read the ADC value and scale it to degrees Celsius.
sensor.scaled_read().unwrap();

Trait Implementations

impl Debug for ADC
[src]

Formats the value using the given formatter.