Hello friends, Who can and will help a new Arduino UNO user? I would be very glad with your help to find out what I am missing and what I am doing wrong.
I soldered the seven seg.display with backpack (ADA881), uploaded the code. (Count down in sec.) All OK, looks nice!!
Afther searching all possible info, I still can't find out:
1// The few lines of code to add for the two dots between minutes and seconds. The first two digits (left side) are for the minutes, the last two (right side) are for the seconds. So I would like the two dots in the middle ON. Afther a lot of tests, I ended by this 2 extra lines of code :
void loop() {
matrix.writeDigitRaw(2,(0x02));
matrix.writeDisplay(); ............
Probably this is wrong or misplaced by me.
2// How to hook up a push button to stop count down and reset to start countdown.
3// The code when using that push button.
/***********************************************
* Count down using millis()
*
* Adafruit 7-segment, I2C, LED backpack display
*
* pin A5 -> C (on 7-segment)
* pin A4 -> D (on 7-segment)
*
************************************************/
#include <Wire.h>
#include "Adafruit_GFX.h"
#include "Adafruit_LEDBackpack.h"
Adafruit_7segment matrix = Adafruit_7segment();
unsigned long previousSecondMillis = 0UL;
long oneSecond = 1000UL; // milliseconds per second
#define startMinute 4 // Modify these defines to
#define startSecond 00 // change the timer interval
int minutes = startMinute;
int seconds = startSecond;
void setup()
{
matrix.begin(0x70);
}
void loop() {
matrix.writeDigitRaw(2,(0x02));
matrix.writeDisplay();
// --------- Run this every second ------------------
if (millis() - previousSecondMillis >= oneSecond) {
matrix.writeDigitNum(0, (minutes / 10));
matrix.writeDigitNum(1, (minutes % 10));
matrix.writeDigitNum(3, (seconds / 10));
matrix.writeDigitNum(4, (seconds % 10));
matrix.writeDisplay();
if (seconds-- == 0) {
if (minutes == 0) {
minutes = startMinute;
seconds = startSecond;
delay(1000);
} else {
minutes -= 1;
seconds = 59;
}
}
previousSecondMillis += oneSecond;
}
}
Many thanks for your help friends!!!
Kind regards, Michel