Introduction: Force Sensitive Resistor Activated Led

Picture of Force Sensitive Resistor Activated Led

Hey Guys! We are going to be using a fsr to turn an led on and change the brightness. You are going to need:

-FSR http://www.amazon.com/gp/product/B00B887CLS/ref=oh...

-arduino uno

-LED

-breadboard

-jumper wires

Step 1: Setting Up the Circuit

Picture of Setting Up the Circuit

first put the fsr anywhere in the breadboard. the put to jumper wires in the row with each lead. Then put one lead to the positive terminals on your breadboard and the other to pin A0 on your arduino. Next put a jumper wire from the positvie terminals to gnd on your ardunio. Then put your led of any color anywhere on your breadboard, preferably on the same half as your fsr. Then take two jumper cables and put them in the same row as the led leads and one will go to the positive terminals on your breadboard and the other to pin 9 on your arduino.

Step 2: Writing the Code

/* Made By: Logan Crawfis

FSR to light LED --------------------------

*/ int sensorPin = A0; // select the input pin for the potentiometer int ledPin = 9; // select the pin for the LED int sensorValue = 0; // variable to store the value coming from the sensor

void setup() { // declare the ledPin as an OUTPUT: pinMode(ledPin, OUTPUT); }

void loop() { // read the value from the sensor: sensorValue = analogRead(sensorPin); if(sensorValue > 1000){ //if the value is greater than 1000 it will light the led digitalWrite(ledPin, LOW);//change the greater than to a less than for it to turn off when you push } else digitalWrite(ledPin, HIGH); }

Comments

SuroorZ (author)2015-10-27

What would you change in the code to keep the led On/Off using the fsr as a switch

ibenkos (author)2014-10-18

Smart idea! Thanks for shearig :)

About This Instructable

1,765views

10favorites

License:

Bio: I'm 15, and I love camping and computers.
More by Shade x Legend:Water Proof Fire StarterPacking Clothes For BackpackingForce sensitive resistor activated led
Add instructable to: