As computing becomes more ubiquitous in our objects, designers need to be more aware of how to design meaningful interactions into electronically enhanced objects. At the University of Washington, a class of junior Interaction Design majors is exploring this question. These pages chronicle their efforts.

Thursday, April 26, 2012

Kelly and Aaron: Push Button, Fade, Motion, and More!

Last week we did the Push Button exercise, and this week we did it again. You can find the documentation here!

Next up, we worked on fading our LED. This was a pretty straightforward experiment, see ours here:


 After that, we decided to choose a PIR sensor (an infrared motion sensor) to experiment with. We first made a simple motion-detector, which lights up a red LED when it detects any motion. We based our code off the initial push-button code and modified it to work with our new sensor. Not as hard as we would have expected! Check out Aaron testing it out:


 Finally, we wanted to push our experiment a little further. We combined what we learned in class last week with our alternating LED "cop lights" with our new PIR sensor to create what is essentially an Arduino-run game of Red Light, Green Light. Here's our infomercial:

 

 When motion was detected, the red LED turns on, and when no motion is detected, the green LED switches on while the red LED turns off. This let us learn exactly how sensitive the PIR sensor was: extremely sensitive! It sensed almost any tiny movement within 30 feet in front of it, even with furniture in the way. We were very impressed with the fidelity of sensor available for $10 at our local Radio Shack! If you want to test our or modify our code for this, try it out below:

const int LED = 13; // the pin for the LED
const int LEB = 8;
const int BUTTON = 7; // the input pin where the // pushbutton is connected
int val = 0; // val will be used to store the state // of the input pin
void setup() {
pinMode(LED, OUTPUT); // tell Arduino LED is an output
pinMode(BUTTON, INPUT); // and BUTTON is an input
} void loop(){
val = digitalRead(BUTTON); // read input value and store it
// check whether the input is HIGH (button pressed)
if (val == HIGH) {
digitalWrite(LEB, LOW);
digitalWrite(LED, HIGH); // turn LED ON
} else {
digitalWrite(LED, LOW);
if (val == LOW) {
digitalWrite(LEB, HIGH); // turn LED ON
} else {
digitalWrite(LEB, LOW);
}
}
}

No comments:

Post a Comment