//EX 1.5 4 EXTERNAL LEDS TO PICO AND CREATE A SEQUENCE OF RUNNING LEDS
/*
void setup() {
// put your setup code here, to run once:
for (int i = 0; i < 4;i++)
pinMode(i, OUTPUT);
}
void blink (int i) {
digitalWrite(i, HIGH);
delay(500);
digitalWrite(i, LOW);
}
void loop() {
// put your main code here, to run repeatedly:
delay(1); // this speeds up the simulation
for (int k = 0; k < 4; k++){
blink(k);
}
}
*/
//EX 1.6 4 EXTERNAL LEDS TO PICO AND CREATE A SEQUENCE OF RUNNING LEDS IN ALTERNATING DIRECTION
void setup() {
// put your setup code here, to run once:
for (int i = 0; i < 4;i++) pinMode(i, OUTPUT);
}
void blink (int i) {
digitalWrite(i, HIGH);
delay(500);
digitalWrite(i, LOW);
}
void loop() {
// put your main code here, to run repeatedly:
delay(1); // this speeds up the simulation
for (int k = 0; k < 4; k++){
blink(k);
}
for (int rev = 3; rev != 0; rev--) blink(rev);
}