Changes

Jump to: navigation, search

Students/Carol Ahn

3,683 bytes added, 20:49, 19 March 2010
no edit summary
Final Diagram:
[[Image:Diagram.jpg]]
'''Arduino Code'''
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
The circuit:
* LED connected from digital pin 13 to ground.
* Note: On most Arduino boards, there is already an LED on the board
connected to pin 13, so you don't need any extra components for this example.
Created 1 June 2005
By David Cuartielles
http://arduino.cc/en/Tutorial/Blink
based on an orginal by H. Barragan for the Wiring i/o board
*/
 
int LT = 7;
int LB = 0;
int BB = 1;
int RB = 2;
int MM = 4;
int RT = 12;
int TT = 8;
 
int ivorycoastSwitch = 13;
 
 
// The setup() method runs once, when the sketch starts
 
void setup() {
 
//Serial.begin(9600);
// initialize the digital pin as an output:
pinMode(RT, OUTPUT);
pinMode(RB, OUTPUT);
pinMode(BB, OUTPUT);
pinMode(LB, OUTPUT);
pinMode(MM, OUTPUT);
pinMode(LT, OUTPUT);
pinMode(TT, OUTPUT);
pinMode(ivorycoastSwitch, INPUT);
clearer();
}
 
// the loop() method runs over and over again,
// as long as the Arduino has power
 
void loop()
{
while (digitalRead(ivorycoastSwitch) > 0) {
one();
delay(1000);
clearer();
five();
delay(1000);
clearer();
if (digitalRead(ivorycoastSwitch) == 0) {
break;
}
delay(3000);
three();
delay(1000);
clearer();
seven();
delay(1000);
clearer();
eight();
delay(1000);
clearer();
if (digitalRead(ivorycoastSwitch) == 0) {
break;
}
delay(3000);
one();
delay(1000);
clearer();
seven();
delay(1000);
clearer();
four();
delay(1000);
clearer();
if (digitalRead(ivorycoastSwitch) == 0) {
break;
}
delay(3000);
two();
delay(1000);
clearer();
zero();
delay(1000);
clearer();
four();
delay(1000);
clearer();
delay(3000);
}
}
 
void zero() {
digitalWrite(LT, LOW);
digitalWrite(TT, LOW);
digitalWrite(RT, LOW);
digitalWrite(RB, LOW);
digitalWrite(BB, LOW);
digitalWrite(LB, LOW);
}
 
void one() {
digitalWrite(RT, LOW);
digitalWrite(RB, LOW);
}
 
void two() {
digitalWrite(LT, LOW);
digitalWrite(RT, LOW);
digitalWrite(MM, LOW);
digitalWrite(LB, LOW);
digitalWrite(BB, LOW);
}
 
void three() {
digitalWrite(LT, LOW);
digitalWrite(RT, LOW);
digitalWrite(MM, LOW);
digitalWrite(RB, LOW);
digitalWrite(BB, LOW);
}
 
void four() {
digitalWrite(TT, LOW);
digitalWrite(MM, LOW);
digitalWrite(RT, LOW);
digitalWrite(RB, LOW);
}
 
void five() {
digitalWrite(TT, LOW);
digitalWrite(LT, LOW);
digitalWrite(MM, LOW);
digitalWrite(RB, LOW);
digitalWrite(BB, LOW);
}
 
void six() {
digitalWrite(TT, LOW);
digitalWrite(LT, LOW);
digitalWrite(MM, LOW);
digitalWrite(LB, LOW);
digitalWrite(BB, LOW);
digitalWrite(RB, LOW);
}
 
void seven() {
digitalWrite(LT, LOW);
digitalWrite(RT, LOW);
digitalWrite(RB, LOW);
 
}
 
void eight() {
digitalWrite(LT, LOW);
digitalWrite(TT, LOW);
digitalWrite(RT, LOW);
digitalWrite(MM, LOW);
digitalWrite(RB, LOW);
digitalWrite(BB, LOW);
digitalWrite(LB, LOW);
}
 
void nine() {
digitalWrite(LT, LOW);
digitalWrite(TT, LOW);
digitalWrite(MM, LOW);
digitalWrite(RT, LOW);
digitalWrite(RB, LOW);
digitalWrite(BB, LOW);
}
 
void clearer() {
digitalWrite(RT, HIGH);
digitalWrite(RB, HIGH);
digitalWrite(MM, HIGH);
digitalWrite(BB, HIGH);
digitalWrite(TT, HIGH);
digitalWrite(LB, HIGH);
digitalWrite(LT, HIGH);
}
==Visualization==
 
Coming soon...
61
edits

Navigation menu