I'm going to write a sketch that would light up the first LED (D1) light of the training shield at the beginning, then will move the LED light to the left or to the right whenever you press the S1 or S2 buttons, respectively. When the LED light is already at the first (D1) or the last (D8), it should no longer move when going further to the left or right, respectively.
Looks exactly like this: https://www.youtube.com/watch?v=_KQQTdDMgOU
Here's what I made so far:
int x = 0;
void setup() {
for(int i=11; i <= 18; i++) {
pinMode(i, OUTPUT);
} }
}
void loop() {
x = digitalRead(pushButtonPin);
if (pushButtonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
}
} else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}