Code:
int pressurePin = A0;
int force;
int LEDpin = 12;
void setup() {
Serial.begin(9600);
pinMode(LEDpin, OUTPUT);
}
void loop() {
force = analogRead(pressurePin);
Serial.println(force);
if(force > 500)
{
digitalWrite(LEDpin, HIGH);
}
else
{
digitalWrite(LEDpin, LOW);
}
delay(100);
}
Wiring Diagram:
Hey Sam I want it to trigger a tone... any suggestions...
ReplyDeleteIf you still need help on this problem instead of the led you would just create a variable for the tone. Instead in the if then statement you would use your tone, hope this helps.
DeleteMama told me not to sell work
ReplyDelete17.5 same color tee shirt.
DeleteHello sam, thanks for the video its crisp and clear.
ReplyDeleteI am a beginner and i would be very grateful if you could help me out here, I want to connect 4 FSR's and 4 led's to the arduino just like you did for one.
Can you give a code for that please.
Dude, you are my hero! Thank you for the video and the blog post!!!!
ReplyDeleteHi, Can you send me a link of the parts you used in this project?
ReplyDeletei plug program in and its saying there is a problem
ReplyDeletenou
DeleteIs there a way to set the project up with more LEDS? I want to be able to measure the different levels of force by three different colors coming on. EX:if(force > 500){ write.LEDpin,Red) BUT if(force < 500){digitalwrite. LEDpin,Yellow) BUT if(force < 250) {digitalwrite. LEDpin, Green). Also, is there a way to extend the force sensor so that its able to connect to something? (how can I correctly write the example code listed above)
ReplyDeleteSorry i have a stupid question:
ReplyDeletewhat if i don't want to light up a led, instead i want a command to appear for instance saying "force is above bla for THIS long". so i want the micro controller to count time and measure the force applied, and give feedback to the user of how long the force is applied for.
sorry I'm just new to the Arduino software and a bit lost.
Just set the (Force>500) to less than 500.
DeleteHey I was wondering if you could make a video showing how to make a servo react to the out puts of a pressure sensor.
ReplyDeleteHi, how would you complete the circuit with more than 1 bulb - 4 for example?
ReplyDeleteThank you for the video! I am in the middle of a school project and using an arduino to communicate with a thin film pressure sensor when to extend and retract a linear actuator. Your code was very helpful and I was able to effectively extend and retract the actuator when a little bit of force is applied to the sensor. However, I want to be able to increase this force so the sensor can have a larger load to it rather than me just setting my finger down and it activating. Do you have any suggestions? Should I use a resistor to increase the resistance? Thank you for your help!
ReplyDeletei am facing difficulty as my LED wont get on when pressure is applied .
ReplyDeleteplease help asap