I am trying to print QRcode (not bitmap) on my thermal printer with Arduino and ESP32.
I am using the same QRcode library and Adafruit Thermal printer library of this post.
How to scale a bitmap (uint8_t array) in Arduino?
Is it possible to convert the pixel coordinates + color to a bitmap or print the pixel(x,y, color)?
Thanks for all
I need some code to print a QRcode. I am using this code to my oled display.
static uint8_t buffer[QR_VERSION_BUFFER_SIZE(7)] = { 0 };
QRCode qrcode = { 0 };
const int8_t error = qrcode_initText(&qrcode, buffer, 7, 0, "1245");
ASSERT_DEBUG_MODE(0 == error);
const uint8_t y0 = 10;
const uint8_t x0 = 10;
for (uint8_t y = 0; y < qrcode.size; y++)
{
for (uint8_t x = 0; x < qrcode.size; x++)
{
uint8_t pixel = 0;
if(qrcode_getModule(&qrcode, x, y) )
{
/*Put black pixel*/
pixel = 0;
}
else
{
/*White pixel*/
pixel = 1;
}
HI_GFX_Draw_Pixel(x0 + x, y0 + y, pixel);
}
}