I am thinking about a cool idea for my 7 segment display clock and I am not sure that it is possible.
So my “problem” which is more like a question, is, is it possible to run the neopixel (with a color cycle) and my clock at the same time without the clock freezing? (I have a blinking “:” in the middle of the 7 segemnt display so thats why I know when it is freezing.)
I made it to blink when the second can be devided by 2 so it is blinking every 2 seconds. If it is not blinking, it is frozen.
As I said it is more like a question, but sure, I can paste a piece of my code.
void setup(void)
{
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show(); // Turn OFF all pixels ASAP
strip.setBrightness(25);
kijelzo.begin(0x70);
kijelzo.setBrightness(fenyero);
Serial.begin(115200);
idoKliens.begin();
idoKliens.setTimeOffset(7200);
}
void loop()
{
oraDolgai();
rainbow(10);
}
void oraDolgai(void)
{
idoKliens.update();
String masodperc = ((idoKliens.getFormattedTime().substring(6)));
String perc = ((idoKliens.getFormattedTime().substring(3)));
String ora = ((idoKliens.getFormattedTime().substring(0)));
int masodpercc = masodperc.toInt();
int oraa = ora.toInt();
int percc = perc.toInt();
unsigned int oraaa = oraa;
unsigned int perccc = percc;
unsigned int masodperccc = masodpercc;
unsigned int ideiglenes = perccc;
do
{
ideiglenes /= 10;
oraaa *= 10;
} while (ideiglenes > 0);
if (perccc < 10)
{
unsigned int kisebb = oraaa * 10;
unsigned int pontosido = kisebb + perccc;
kijelzo.print(pontosido);
}
else
{
unsigned int pontosido2 = oraaa + perccc;
kijelzo.print(pontosido2);
}
if (masodpercc % 2) {
kijelzo.drawColon(false);
}
else
{
kijelzo.drawColon(true);
}
kijelzo.writeDisplay();
}
void rainbow(int wait)
{
for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256)
{
for(int i=0; i<strip.numPixels(); i++)
{
int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
}
strip.show();
delay(wait);
}
}
Please don’t mind my AWFUL clock code which totally doesn’t make any sens, but it is working lol
I also have a weather monitor in my program so I won’t paste the whole code because thats like 400+ lines.