1

I am using qrcode library https://github.com/ricmoo/QRCode

for generating QR code at runtime

but i can not print it using Adafruit Thermal Printer

which uses method printer.printBitmap(x,y,qrdata)

now my problem is how to convert the qrcode generated from qrcode library to

static const uint8_t PROGMEM adaqrcode_data[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, .....

edit :

i tried the code

QRCode qrcode;
int  buffsize = qrcode_getBufferSize(10);
uint8_t *qrcodeBytes= malloc(buffsize);
qrcode_initText(&qrcode, qrcodeBytes, 10, ECC_LOW, "Test");
const uint8_t myB[qrcode.size]={qrcode.modules};
printer.printBitmap(50,50,myB,false);

qrcode.modules is the bytes of qrcode

it prints as shown in picture attached ... and its not qrcode !

Image

  • Where did you get that the size of the QR code is 50? How long is `qrcode.modules`? – Tom Apr 18 '20 at 19:48
  • 50,50 is the width and height of image qrcode.size is the size of qrcode.modules bytes array – user1549555 Apr 18 '20 at 19:55
  • In that case, don't you have 50x50=2500 values? if qrcode.size=50 you did not allocate enough space for myB. Bitmap are huge, that is why Adafruit usually store them in progspace. – Tom Apr 18 '20 at 20:13
  • i think the main problem is how to get thermal printer format from qrcode outeput the QRCode https://github.com/ricmoo/QRCode produces array of bytes but how o convert them to thermal printer image format so i can print it using Adafruit Thermal Library. – user1549555 Apr 18 '20 at 22:04

0 Answers0