The arduino sketch is still very basic at the moment and only evaluate the force applied by the finger on the sensor on a scale of 0 to 1000.
I now have to connect the live datas to processing or openframeworks.
//FSRx2 test sketch.
//Connect one end of FSR to power, the other end to Analog 0.
//Then connect one end of a 10K resistor from Analog 0 to ground
int fsrPin = 0;
int fsrPin2 = 1;
int fsrReading;
int fsrReading2;
void setup(void) {
// We'll send debugging information via the Serial monitor
Serial.begin(9600);
}
void loop(void) {
fsrReading = analogRead(0);
fsrReading2 = analogRead(1);
Serial.print("Analog reading = ");
Serial.print(fsrReading);
if (fsrReading < 10) {
Serial.println(" - No pressure");
} else if (fsrReading < 200) {
Serial.println(" - Light touch");
} else if (fsrReading < 500) {
Serial.println(" - Light squeeze");
} else if (fsrReading < 800) {
Serial.println(" - Medium squeeze");
} else {
Serial.println(" - Big squeeze");
}
delay(1000);
Serial.print("Analog reading2 = ");
Serial.print(fsrReading2);
if (fsrReading2 < 10) {
Serial.println(" - No pressure");
} else if (fsrReading2 < 200) {
Serial.println(" - Light touch");
} else if (fsrReading2 < 500) {
Serial.println(" - Light squeeze");
} else if (fsrReading2 < 800) {
Serial.println(" - Medium squeeze");
} else {
Serial.println(" - Big squeeze");
}
delay(1000);
}
No Response to "Control module - electronic Part2"
Post a Comment