Hi,
I made a personal font from 0 to 9 that is 3 segment wide and 4 height coded in HEX.
Everything goes well, when I try to acess one letter after uploading
but with a simple count, I have strange behavior and the letter are not recognizable.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"
#include "Font.h"
static const uint16_t PROGMEM
font[] =
{ 0xF6F, 0x597, 0xC57, 0xE8E, 0x53A, 0xF8E, 0x7AA, 0xE54, 0xFEF, 0xF5F
};
Adafruit_BicolorMatrix matrix = Adafruit_BicolorMatrix();
int8_t count;
void setup() {
matrix.begin(0x70);
}
void loop() {
if (count < 9) count++;
else count = 0;
matrix.clear();
drawLetter(0, 0, font[count], LED_GREEN);// with number (0, 1, 2, ...9) it works but not with my count
matrix.writeDisplay();
delay(1200);
}
void drawLetter(int8_t x, int8_t y, uint16_t letter, uint8_t color) {
for (int8_t i = 11; i >= 0; i--) {
if ((letter & (1 << i)) > 0) matrix.drawPixel(x + (2 - (i % 3)), y + ((11 - i) / 3), color);
}
}