// source code
int delayTime1 = 100;
int delayTime2 = 200;
int delayTime3 = 300;
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
for(int i=13;i>=0;i--)
pinMode(i, OUTPUT);
}
void loop() {
// Port7 to 13 - turn on and turn off
for(int i=13;i>=7;i--)
{
digitalWrite(i, HIGH); // set the LED on
}
delay(delayTime1);
for(int i=13;i>=7;i--)
{
digitalWrite(i, LOW); // set the LED on
}
delay(delayTime3);
// Port0 to 6 - turn on and turn off
for(int i=6;i>=0;i--)
{
digitalWrite(i, HIGH); // set the LED on
}
delay(delayTime1);
for(int i=6;i>=0;i--)
{
digitalWrite(i, LOW); // set the LED on
}
delay(delayTime3);
// Port7 to 13 - decrease and increase
for(int i=7;i<=13;i++)
{
digitalWrite(i, HIGH); // set the LED on
delay(delayTime1); // wait for a second
digitalWrite(i, LOW); // set the LED off
delay(delayTime1);
}
delay(delayTime3);
for(int i=13;i>=7;i--)
{
digitalWrite(i, HIGH); // set the LED on
delay(delayTime1); // wait for a second
digitalWrite(i, LOW); // set the LED off
delay(delayTime1);
}
// Port0 to 6 - decrease and increase
for(int i=0;i<=6;i++)
{
digitalWrite(i, HIGH); // set the LED on
delay(delayTime1); // wait for a second
digitalWrite(i, LOW); // set the LED off
delay(delayTime1);
}
delay(delayTime3);
for(int i=6;i>=0;i--)
{
digitalWrite(i, HIGH); // set the LED on
delay(delayTime1); // wait for a second
digitalWrite(i, LOW); // set the LED off
delay(delayTime1);
}
delay(delayTime3);
//
for(int i=13;i>=0;i--)
{
digitalWrite(i, HIGH); // set the LED on
delay(delayTime1);
}
delay(delayTime3);
for(int i=13;i>=0;i--)
{
digitalWrite(i, LOW); // set the LED on
delay(delayTime1);
}
delay(delayTime3);
//
for(int i=0;i<=13;i++)
{
digitalWrite(i, HIGH); // set the LED on
delay(delayTime1);
}
delay(delayTime2);
for(int i=0;i<=13;i++)
{
digitalWrite(i, LOW); // set the LED on
delay(delayTime1);
}
delay(delayTime1);
}
沒有留言:
張貼留言