upm  0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Public Member Functions
Flex Class Reference

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

Detailed Description

A simple flex sensor. The resistance across the sensor increases when flexed. 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 sensor destructor

Member Function Documentation

int value ( )
Returns
Analog flex value

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