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.

Tuesday, June 11, 2013

Working Rough Prototype [Maddie and Candice]

Motion is sensed. Bubbles are triggered. Happiness is had by all.



// Customized code based on http://stratigrafia.org/blog/entries/2012-09-01.html

int pirPin = 4; // digital pin 4 for PIR; put a 10k Ohm resistor between pin 4 and OUT on PIR
int ledPin = 7; // digital pin 13 for LED; put a 220 Ohm resistor between pin 13 and the LED
int noMotion = 1;
int TIP120pin = 9; //for this project, I pick Arduino's PMW pin 11

void setup() {
  pinMode(pirPin, INPUT); // set PIR pin as input
  pinMode(ledPin, OUTPUT); // set LED pin as output
  pinMode(TIP120pin, OUTPUT); // Set pin for output to control TIP120 Base pin
}

void loop() {
  int movementSensor=digitalRead(pirPin);

  if(movementSensor == HIGH) {
  // motion detected
    if (noMotion == 0) {
  // make bubbles only if coming from a state of no motion
      digitalWrite(TIP120pin, HIGH);
      digitalWrite(ledPin, HIGH);
 
      noMotion=1;
    }
  } else {
    // No motion
    digitalWrite(TIP120pin, LOW);
    digitalWrite(ledPin, LOW);
    noMotion=0;
  }
}

No comments:

Post a Comment