Académique Documents
Professionnel Documents
Culture Documents
void setup() {
for(int i =0; i<=7; i++)
{
pinMode(i, OUTPUT); // Sets pins 0-7 as OUTPUT
}
pinMode(D1, OUTPUT); // Sets DIGIT1 (Pin 13) as OUTPUT
pinMode(D0, OUTPUT); // Sets DIGIT0 (Pin 12) as OUTPUT
digitalWrite(7,HIGH); // Turns off DP segment, replace HIGH with LOW to enable
decimals
}
void loop() {
for (int digit1=9; digit1>=0; digit1--) // Variable for second digit from 0 to 9
{
for (int digit0=9; digit0>=0; digit0--) // Variable for first digit from 0 to 9
{
unsigned long startTime = millis();
for (unsigned long elapsed = 0; elapsed <= 1000; elapsed = millis() - startTime)
// This is wherein one sets the delay for each digit 1000ms or 1s as default
{
lightDigit1(numbers[digit1]); // Quickly turns off DIGIT1 so that data is stored
delay(MPX);
lightDigit0(numbers[digit0]); // Quickly turns off DIGIT0 so that data is stored
delay(MPX);
}}}}