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.

Monday, April 30, 2012

Kelly and Aaron: A Non-LED Actuator

This week we decided to try using our PIR motion sensor from last week with a new actuator. Instead of an LED, we now have a Piezo Buzzer! We used the buzzer to create a more nerve-wracking version of Red Light, Green Light: the green still means go, but when the sensor catches you, it now buzzes in F# until you freeze. Our setup is pretty similar to last week, as you can see in this photo:

























Check out our code below:

const int BEEP = 9; // the pin for the beeper
const int GREEN = 8; 
const int SENSOR = 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(BEEP, OUTPUT); // tell Arduino LED is an output 
pinMode(SENSOR, INPUT); // and BUTTON is an input 

void loop(){ 
val = digitalRead(SENSOR); // read input value and store it // check whether the input is HIGH (button pressed) if (val == HIGH) 

digitalWrite(GREEN, LOW); 
tone(9, 2800); // turn LED ON 
} else { noTone(9); 
if (val == LOW) 

digitalWrite(GREEN, HIGH); // turn LED ON } 
else { digitalWrite(GREEN, LOW); 


}

No comments:

Post a Comment