Closed seanspotatobusiness closed 4 years ago
No no such function exists. What is the rationale for this functionality?
it should be something like this
void testAll()
{
for (uint8_t i = 0; i < 5; i++) writePos(i, 255);
};
or far more fancy something like
void testAll()
{
// for (uint8_t i = 0; i < 5; i++) writePos(i, 255);
for (uint8_t i = 0; i < 5; i++)
{
for (int j = 0; j < 256; j <<= 1, j |= 1)
{
writePos(i, (uint8_t)j);
delay(100);
}
}
};
you can copy the above in th .h file of the lib to give it a try.
maybe 2 functions just on()
and off()
in a sense displayTest()
does test all leds but also all possible combinations.
If there is a short circuit somewhere it should become visible with this call as all digits should be same in every step.
void HT16K33::displayTest(uint8_t del)
{
for (int i = 0; i < 256; i++)
{
writePos(0, i);
writePos(1, i);
writePos(2, i);
writePos(3, i);
writePos(4, i);
delay(del);
}
}
set del to 0 for fast test (< 1 second)
Thanks for your help but I'm afraid I don't know how to implement your advice. I'm using version 0.24 of your library (the latest installed via the Library Manager in the Arduino IDE (1.8.13)).
I copied this into HT16K33.h, just above // -- END OF FILE --
void testAll() { for (uint8_t i = 0; i < 5; i++) writePos(i, 255); };
I then replaced "test_printfloat();" with "testAll();" in test_printfloat.ino but when I try to compile I get errors revolving around writePos:
E:\Projects\Electronics\Arduino sketches\libraries\HT16K33/HT16K33.h:77:35: error: 'writePos' was not declared in this scope
for (uint8_t i = 0; i < 5; i++) writePos(i, 255);
^~~~~~~~
E:\Projects\Electronics\Arduino sketches\libraries\HT16K33/HT16K33.h:77:35: note: suggested alternative: 'fwrite'
for (uint8_t i = 0; i < 5; i++) writePos(i, 255);
^~~~~~~~
fwrite
exit status 1
Error compiling for board Arduino Nano.
Do you know how to resolve this? Thanks again for your help.
What platform do you use?
I copied this into HT16K33.h, just above // -- END OF FILE --
That is outside the class definition, you should include it just above the word private: (line 62 or so)
For the upcoming 0.3.0 version I extended the interface of displayRaw(uint *ar, bool colon = false) so you can also switch on/off the colon to allow you to switch on all leds in 2 lines - here wrapped in a function:
void testAll()
{
uint8_t x[4] = { 255, 255, 255, 255 };
seg.displayRaw(x, true);
}
I choose for this solution as it is more flexible than the first proposed testAll()
extended displayRaw() included, 0.3.0 released
Hi. Is there a function to illuminate all LEDs in the display at once (i.e. all decimal places and the colon and set all digits to 8)? Thanks.