1

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);

    }

}
Peter Paul Kiefer
  • 1,883
  • 8
  • 10
Thibis
  • 11
  • 4
  • Honestly I don't understand what you mean. Please explain more and include your code. Explain, what exactly in that code is the problem – chrisl Dec 12 '19 at 16:28
  • Read the README of that library in the API section. Where it uses Serial.print use whatever pixel drawing function you have. – Majenko Dec 12 '19 at 16:28
  • Add the code that I am using to print the QRcode on the screen. I don't know a function for print a pixel. – Thibis Dec 16 '19 at 11:07

0 Answers0