Materials:
high heel shoe (Payless Shoe Store)
14 LEDs (available in class)
force(pressure) sensor (available in class)
vibration motor (http://www.sparkfun.com/products/8449)
wires (available in class)
Arduino Mini Pro 3.3V (http://www.amazon.com/Arduino-Pro-Mini-328-3-3V/dp/B004G53J6M)
9V battery pack (available in class)
FTDI TTL-232R-3V3 USB - TTL Level Serial Converter Cable (available in class)
solder (available in class)
Remove these ads by
Signing UpStep 1Code for force sensor and LED
int sensePin = 2; // the pin the FSR is attached to
int pressureLevel = 4;
int timeCount = 0;
int pressureCount = 0;
int lengthOfTime = 5;
void setup() { Serial.begin(9600);
pinMode(2, OUTPUT); //declare the ledPin as an OUTPUT need for all pins
}
void loop() { int pressure = analogRead(sensePin) ;
if (millis() % 1000 == 0) { //60000 for one minute,
timeCount ++;
if (pressure > 500) {
pressureCount ++;}
if ((timeCount > lengthOfTime) && (pressureCount > pressureLevel)) { //activate when 4 out of 5 times
digitalWrite(2, HIGH);
timeCount=0;
}
Serial.println(pressure);
}
}
| « Previous Step | Download PDFView All Steps | Next Step » |
1
comment
|
Add Comment
|
zazenergy
says:
![]() |
Add Comment
|













































