// Exercise 06: Displaying Negative Numbers
// Objective: Continue working with a 7-segment display on an Arduino.
// This time, your task is to cycle through numbers -10 to 10 and display them sequentially
// on the 7-segment display, utilizing three digits for numbers.
//
// ┌────────────┬───────────────┬───────────────┬───────────────┬───────────────┐
// │ │ │ │ │ │
// │ │ ══0══ │ ══0══ │ ══0══ │ ══0══ │
// │ │ ║ ║ │ ║ ║ │ ║ ║ │ ║ ║ │
// │ Segment │ 5 1 │ 5 1 │ 5 1 │ 5 1 │
// │ │ ║ ║ │ ║ ║ │ ║ ║ │ ║ ║ │
// │ │ ══6══ │ ══6══ │ ══6══ │ ══6══ │
// │ Index │ ║ ║ │ ║ ║ │ ║ ║ │ ║ ║ │
// │ │ 4 2 │ 4 2 │ 4 2 │ 4 2 │
// │ │ ║ ║ │ ║ ║ │ ║ ║ │ ║ ║ │
// │ │ ══3══ ○ │ ══3══ ○ │ ══3══ ○ │ ══3══ ○ │
// │ │ 7 │ 7 │ 7 │ 7 │
// ├────────────┼───────────────┼───────────────┼───────────────┼───────────────┤
// │ Digit │ │ │ │ │
// │ │ 3 │ 2 │ 1 │ 0 │
// │ Index │ │ │ │ │
// └────────────┴───────────────┴───────────────┴───────────────┴───────────────┘
const int NUMBER_OF_SEGMENTS = 8;
const int PINS_SEGMENTS [] = {3,7,A2,A4,A5,4,A1,A3};
const int NUMBER_OF_DIGITS = 4;
const int PINS_DIGITS [] = {2,5,6,A0};
// Define a 2D array to represent the segments of each digit on a seven-segment display.
// Each row corresponds to a digit (0 to 9), and each column represents a segment.
// You can access it like this: SEVEN_SEGMENT_DIGITS[0][6] → 0
const int SEVEN_SEGMENT_DIGITS[][NUMBER_OF_SEGMENTS] = {
{1, 1, 1, 1, 1, 1, 0}, // Digit 0: Segments 0, 1, 2, 3, 4, 5
{0, 1, 1, 0, 0, 0, 0}, // Digit 1: Segments 1, 2
// ...
};
void setup() {
// configure all outputs
}
void loop() {
// loop through -10...10
}