Howdy,
This has me puzzled. I have a MAX7219 connected to a 5 digit 7 segment display.
I can set the digits to whatever I want in setup(), but I tried making a simple counter, and it will not update.
I say it will not update, but sometimes it will a couple of times and then just go blank.
#include <LedControl.h>
#include <time.h>
LedControl mydisplay = LedControl(52, 54, 56, 1);
int delayTime = 500;
byte digit= 0; // I have tried int as well
unsigned int currentTime = 0;
unsigned int lastChange = 0;
void setup() {
// this works
mydisplay.shutdown(0, false);
mydisplay.setIntensity(0, 8);
mydisplay.setDigit(0, 0, 8, true);
mydisplay.setDigit(0, 1, 8, true);
mydisplay.setDigit(0, 2, 8, true);
mydisplay.setDigit(0, 3, 8, true);
mydisplay.setDigit(0, 4, 8, true);
// every part of the display is lit
delay(1000);
mydisplay.clearDisplay(0);
delay(500);
lastChange = millis();
currentTime = millis();
lastChange = currentTime;
}
void loop() {
currentTime = millis();
if ((lastChange + delayTime) <= currentTime)
{
lastChange = currentTime;
digit = digit + 1;
if (digit == 10)
digit = 1;
// this might work or might not...generally not... ????
// if it does, it won't get through the count all the way
mydisplay.setDigit(0, 0, digit, true);
}
I appreciate any feedback.
Thanks,
John