For this lab I decided to again incorporate my wallet as the location for my input and output. By opening the wallet and spreading it to access the money the user sets off the force sensor. As a reminder to not spend money on unnecessary things a red LED begins to blink and rapidly decreases the delay between the High and Low settings of the LED. I initially was going to use a photocell and the piezo as my input and output respectively. After thinking about the situations where I might be spending more money than I would want, I kept thinking of bars where light and sound are not reliable sources for input and output. This moved me to the physical action of opening the wallet and the blinking LED. While light might not always be the greatest output at bars, I’m usually looking directly into the wallet and more likely to see the light regardless of the surrounding environment.
Video
https://docs.google.com/file/d/0BzquLLPdhTEkUFpuV3ZZQjJRd1k/edit?usp=drive_web
/*
Kevin Lessard
TUI Lab 5
Input/Output coincidence
10/14/2013
*/
int inputpin = 0;
int ledpin = 10;
int val = 0;
int flash = 50;
void setup()
{
pinMode(ledpin, OUTPUT);
}
void loop()
{
val = analogRead(inputpin);
while(val>300){
digitalWrite(ledpin, HIGH); // turn the LED on (HIGH is the voltage level)
delay(flash); // wait
digitalWrite(ledpin, LOW); // turn the LED off by making the voltage LOW
delay(flash);
flash = flash - 5; //increases the blinking rate
if(flash == 0){ //breaks out of the while loop when the blinking delay is 0
flash = 50;
break; //breaks out of the while loop
}
}
delay(100);
}
- Login to post comments