const int pins[] = {23, 22, 19, 18, 5, 21, 4};
const int data[10][8] = {
{0, 0, 0, 0, 0, 0, 1}, // 0
{1, 0, 0, 1, 1, 1, 1}, // 1
{0, 0, 1, 0, 0, 1, 0}, // 2
{0, 0, 0, 0, 1, 1, 0}, // 3
{1, 0, 0, 1, 1, 0, 0}, // 4
{0, 1, 0, 0, 1, 0, 0}, // 5
{0, 1, 0, 0, 0, 0, 0}, // 6
{0, 0, 0, 1, 1, 1, 1}, // 7
{0, 0, 0, 0, 0, 0, 0}, // 8
{0, 0, 0, 0, 1, 0, 0} // 9
};
const int switchPin = 14;
int currentValue = 0;
int switchState;
int lastSwitchState = HIGH;
void setup() {
for (int x = 0; x < 7; x++) {
pinMode(pins[x], OUTPUT);
}
pinMode(switchPin, INPUT_PULLUP);
}
void loop() {
switchState = digitalRead(switchPin);
if (switchState == LOW && lastSwitchState == HIGH) {
currentValue = (currentValue + 1) % 10;
}
for (int x = 0; x < 7; x++) {
digitalWrite(pins[x], data[currentValue][x]);
}
lastSwitchState = switchState;
delay(100);
}