I have made a class called ClockDisplay.
Initializing like seen below works beutifull:
#include <ClockDisplay.h>
ClockDisplay* clockui;
int seconds;
void setup() {
clockui= new ClockDisplay(12,11,10);
}
void loop() {
delay(1000);
clockui->Display(seconds/60,seconds%60);
seconds++;
}
It Compiles downloads and runs (I can se the clock ticking on my display).
However this code gives me a headache...
#include <ClockDisplay.h>
ClockDisplay clockui(12,11,10);
int seconds;
void setup() {
Serial.begin (115200);
Serial.println("setup running");
}
void loop() {
delay(1000);
clockui.Display(seconds/60,seconds%60);
seconds++;
Serial.println("loop running");
}
- It Compiles and downloads without warnings
- I inserted some printlns but they never execute. (nothing on the console(neither from setup nor loop))
- So it looks like it somehow "hangs up" in my constructor.
The constructor of my object looks like this:
(It wraps an ledControl...)
ClockDisplay::ClockDisplay(int dataPin, int clkPin, int csPin) {
lc= new LedControl(dataPin,clkPin,csPin,2);
for(int address=0;address<2;address++) {
/*The MAX72XX is in power-saving mode on startup*/
lc->shutdown(address,false);
/* Set the brightness to a medium values */
lc->setIntensity(address,8);
/* and clear the display */
lc->clearDisplay(address);
delay(100);
lc->setAll(address);
delay(100);
lc->clearDisplay(address);
};
}
I am looking forward for any kind of help, that may show me in what direction to go