Datasheet

NOT WORKING? (3 things to try)
MAKING IT BETTER
CODE (no need to type everything in just click)
MORE, MORE, MORE:
33
CIRC-13
Download the Code from (http://ardx.org/CODE13A)
(copy the text and paste it into an empty Arduino Sketch)
More details, where to buy more parts, where to ask more questions:
Fading to Fast/Slow
This is a result of the FSRs
response to pressure not
being quite linear. But do not
fear it can be changed in
code (check out the details in
the Making it Better section)
Looking For More?
(shameless plug)
If you’re looking to do more
why not check out all the
lovely extra bits and bobs
available from
http://www.Adafruit.com
LED Not Lighting Up?
LEDs will only work in one
direction. Try taking it out and
twisting it 180 degrees.
(no need to worry, installing it
backwards does no permanent
harm).
Calibrating the Range Then replace the fromHigh value with the
unpressed value. (finally fill in the range toLow = 0 &
While the light is now fading chances are its
toHigh = 255)
response isn’t quite perfect. To adjust the
response we need to add one more line to our
The result will look something like this.
code.
int value = analogRead(sensePin);
map(value, fromLow, fromHigh,
map(value, 125, 854, 0, 255);
toLow, toHigh)
analogWrite(ledPin, value);
For full details on howthe map function works:
Applications
http://ardx.org/MAP
With sensors the real fun comes in using them in neat
To calibrate our sensor we can use the debug
and un-expected ways. So get thinking about how
window (like in CIRC-11). Open the debug
and where sensing squeeze could enhance your life.
window then replace the fromLow value with the
value displayed when the sensor is fully pressed.
/*
* Force Sensitive Resistor Test Code
*
* The intensity of the LED will vary with the amount of pressure on the sensor
*/
int sensePin = 2; // the pin the FSR is attached to
int ledPin = 9; // the pin the LED is attached to (use one capable of PWM)
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
}
void loop() {
int value = analogRead(sensePin) / 4; //the voltage on the pin divded by 4 (to
//scale from 10 bits (0-1024) to 8 (0-255)
analogWrite(ledPin, value); //sets the LEDs intensity proportional to
//the pressure on the sensor
Serial.println(value); //print the value to the debug window
}
http://adafruit.com