upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
Public Member Functions | List of all members

API for the Grove Slide Potentiometer. More...

Detailed Description

Basic UPM module for the Grove slide potentiometer on analog that returns either a raw value or a scaled voltage value.

// Instantiate new grove slide potentiometer on analog pin A0
while (true) {
float raw_value = slide.raw_value();
float value = slide.voltage_value();
System.out.println("raw value: " + raw_value);
System.out.println("value: " + value);
Thread.sleep(2500);
}
groveslide.jpeg

Public Member Functions

synchronized void delete ()
 
 GroveSlide (long pin, float ref_voltage)
 
 GroveSlide (long pin)
 
float raw_value ()
 
float voltage_value ()
 
float ref_voltage ()
 
- Public Member Functions inherited from Grove
synchronized void delete ()
 
String name ()
 

Constructor & Destructor Documentation

GroveSlide ( long  pin,
float  ref_voltage 
)

Grove analog slide potentiometer constructor

Parameters
pinNumber of the analog pin to use
ref_voltageReference voltage the board is set to, as a floating-point value; default is 5.0V

Member Function Documentation

float raw_value ( )

Gets the raw value from the AIO pin

Returns
Raw value from the ADC
float ref_voltage ( )

Gets the board's reference voltage passed on object initialization

Returns
Reference voltage the class was set for
float voltage_value ( )

Gets the voltage value from the pin

Returns
Voltage reading based on the reference voltage
Inheritance diagram for GroveSlide:
Inheritance graph
[legend]
Collaboration diagram for GroveSlide:
Collaboration graph
[legend]

The documentation for this class was generated from the following file: