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 25, 2013

Randy & Charlie: Count Arduino

Count Blink with For Loop


int ledPin = 13;    // LED connected to digital pin 13
int count = 1;      // Keeps count of which number it's on

void setup()  { 
  pinMode(ledPin, OUTPUT);     // set pin 13 as output
} 

void loop()  { 
   for (int i = 0; i < count; i++) {
      digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
      delay(200);                     // wait for a second
      digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
      delay(200);      
   }
   
   count++;                           // increments count
   
   if (count > 5) {                   // if count reaches 5, then start over from 1
     count = 1;
   }
   
   delay(1500);                       // delay between next blinking sequence
}



Count Blink with Brute Force


int ledPin = 13;    // LED connected to digital pin 13
int count = 1;      // Keeps count of which number it's on

void setup()  { 
  pinMode(ledPin, OUTPUT);     // set pin 13 as output
} 

void loop()  { 
   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   delay(1500);                    // delay between next blinking sequence

   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   delay(1500);                    // delay between next blinking sequence

   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   delay(1500);                    // delay between next blinking sequence

   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   delay(1500);                    // delay between next blinking sequence

   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   digitalWrite(ledPin, HIGH);     // turn the LED on (HIGH is the voltage level)
   delay(200);                     // wait for a second
   digitalWrite(ledPin, LOW);      // turn the LED off by making the voltage LOW
   delay(200);   

   delay(1500);                    // delay between next blinking sequence
}

No comments:

Post a Comment