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.

Wednesday, April 24, 2013

1-5 Blink LED, and Button


Button exercise 
With some hep from Sandy, I was able to to the blinks. Here is the code:

/*
Count to 5.

This code counts from one flash of an LED up to 5 flashes, and then loops.

ELEGANT
 */
 
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;


void setup() {                
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);     
}

void loop() {
  int i = 1;  //counter variable
  int j = 1;  //counter variable
  
  for(i=1; i<6; ++i){
    for(j=1; j<=i; ++j){
      digitalWrite(led, HIGH);   // 1 Flash
      delay(200);              
      digitalWrite(led, LOW);    
      delay(400);      
    } 
  delay(1000);    
  }
  
}

No comments:

Post a Comment