upm  0.3.1
Sensor/Actuator repository for libmraa (v0.7.2)
Public Member Functions

API for the Spectra Symbol Flex sensor. More...

Detailed Description

A simple flex sensor, the resistance across the sensor increases when bent. Patented technology by Spectra Symbol, these sensors were used in the original Nintendo Power Glove.

flex.jpg


Flex Sensor image provided by SparkFun under CC BY-NC-SA-3.0.

// The was tested with a Spectra Symbol flex sensor.
// We attached a 22K resistor to a breadboard,
// with 1 end attached to GND and the other connected to
// both the flex sensor and A0.
// The flex sensor was connected on 1 pin to the 22K resistor and A0
// and on the other pin to 5V.
// Instantiate a Flex sensor on analog pin A0
upm::Flex *flex = new upm::Flex(0);
while (shouldRun)
{
cout << "Flex value: " << flex->value() << endl;
sleep(1);
}

Public Member Functions

 Flex (int pin)
 
 ~Flex ()
 
int value ()
 

Constructor & Destructor Documentation

Flex ( int  pin)

Flex sensor constructor

Parameters
pinanalog pin to use
~Flex ( )

Flex Destructor

Member Function Documentation

int value ( )
Returns
the analog flex value

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