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

API for the Grove Rotary Angle Sensor (Knob) More...

Detailed Description

Basic UPM module for the Grove rotary angle sensor (knob) on analog. Provides a set of functions to read the absolute pin value, degrees or radians, and another set to do the same relative to the center of the knob range.

while (true) {
float abs_value = knob.abs_value(); // Absolute raw value
float abs_deg = knob.abs_deg(); // Absolute degrees
float abs_rad = knob.abs_rad(); // Absolute radians
float rel_value = knob.rel_value(); // Relative raw value
float rel_deg = knob.rel_deg(); // Relative degrees
float rel_rad = knob.rel_rad(); // Relative radians
System.out.println("Absolute: " + abs_value + " raw, " + abs_deg + " deg, " + abs_rad
+ " rad");
System.out.println("Relative: " + rel_value + " raw, " + rel_deg + " deg, " + rel_rad
+ " rad");
Thread.sleep(3000);
}
groverotary.jpeg

Public Member Functions

synchronized void delete ()
 
 GroveRotary (long pin)
 
float abs_value ()
 
float abs_deg ()
 
float abs_rad ()
 
float rel_value ()
 
float rel_deg ()
 
float rel_rad ()
 
- Public Member Functions inherited from Grove
synchronized void delete ()
 
String name ()
 

Constructor & Destructor Documentation

GroveRotary ( long  pin)

Grove rotary angle sensor constructor

Parameters
pinNumber of the analog pin to use

Member Function Documentation

float abs_deg ( )

Gets absolute raw degrees from the AIO pin

Returns
Unsigned degrees from the ADC
float abs_rad ( )

Gets absolute raw radians from the AIO pin

Returns
Unsigned radians from the ADC
float abs_value ( )

Gets the absolute raw value from the AIO pin

Returns
Unsigned value from the ADC
float rel_deg ( )

Gets relative degrees from the AIO pin

Returns
Signed degrees from the ADC
float rel_rad ( )

Gets relative radians from the AIO pin

Returns
Signed radians from the ADC
float rel_value ( )

Gets the relative value from the AIO pin

Returns
Signed value from the ADC
Inheritance diagram for GroveRotary:
Inheritance graph
[legend]
Collaboration diagram for GroveRotary:
Collaboration graph
[legend]

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