Wednesday, October 21, 2009

More Process

After some thought and experimenting, we decided that the flex sensor in the originally plan wasn't going to work. We all agreed on using force sensors instead.


This is the code I used to test the force sensors. I used a very similar code, just with different values to test the flex sensors, but they didn't read very well unless they were greatly bent, and our project design wouldn't allow that.


int forcesensor = 0;
byte val = 0;

void setup() {
Serial.begin(9600);
Serial.println("Wave test");
pinMode(0, OUTPUT);

void loop() {
val = analogRead(forcesensor);

if(val>20 && <=300) {
Serial.println("light squeeze");}
else if(val >300 && <=500){
Serial.println("medium squeeze");}
else if(val > 500) {
Serial.println("hard squeeze");}}

No comments:

Post a Comment