/* I referenced the FSR simple testing sketch from Lady ADA
For more information see www.ladyada.net/learn/sensors/fsr.html
——————
PSUEDO CODE
——————
-Get two FSR switches reading
-When both FSR’s are pressed turn on Light
-When FSR’s are no longer pressed turn off light
——————
*/
int fsrPin = 5; // the FSR and 10K pulldown are connected to a5
int fsrReading; // the analog reading from the FSR resistor divider
int fsrPin2 = 4; // the FSR and 10K pulldown are connected to a4
int fsrReading2; // the analog reading from the FSR resistor divider
const int ledPin = 3; // relay is triggered which turns on lights
int x = 0; // variable we’re using to set lights on/off
void setup(void) {
// We’ll send debugging information via the Serial monitor
pinMode(ledPin, OUTPUT); // sets lightbulb relay as output
Serial.begin(9600);
}
void loop(void) {
fsrReading = analogRead(fsrPin);
fsrReading2 = analogRead(fsrPin2);
// Serial.print(“Analog reading = “);
// Serial.print(fsrReading); // the raw analog reading
if (fsrReading > 50 && fsrReading2 > 25){
Serial.println(“ON”);
x=1; // lights on
}
// if both FSR’s are recieving more pressure than the given numbers x=1
else{
x=0; //lights off
}
digitalWrite(ledPin, x); //
delay(500);
}