/*
Arduino Roulette
Single zero wheel
2/1/26
AnonEngineering
*/
const int NUM_GROUPS = 6;
const int NUM_SEGMENTS = 7;
const int GROUP_PINS[] = {A0, A1, A2, A3, A4, A5};
const int SEGMENT_PINS[] = {8, 7, 6, 5, 4, 3, 2};
void setup() {
Serial.begin(115200);
for (int i = 0; i < NUM_SEGMENTS; i++) { // 7 "segments" per group
pinMode(SEGMENT_PINS[i], OUTPUT);
}
for (int i = 0; i < NUM_GROUPS; i++) { // 6 groups
pinMode(GROUP_PINS[i], OUTPUT);
digitalWrite(GROUP_PINS[i], HIGH); // set group pins HIGH (off)
}
}
void loop() {
for (int group = 0; group < NUM_GROUPS; group++) {
digitalWrite(GROUP_PINS[group], LOW);
for (int segment = 0; segment < NUM_SEGMENTS; segment++) {
Serial.print("Number: ");
Serial.println((group * NUM_SEGMENTS) + segment);
digitalWrite(SEGMENT_PINS[segment], HIGH);
delay(500);
digitalWrite(SEGMENT_PINS[segment], LOW);
delay(20);
// reset at 36 (37th count)
if (group >= 5 && segment >= 1) {
digitalWrite(GROUP_PINS[group], HIGH);
group = 0;
segment = 0;
return;
}
}
digitalWrite(GROUP_PINS[group], HIGH);
}
}