Can I display QR code in the OLED dysplay?
For example this library:
Can I display QR code in the OLED dysplay?
For example this library:
The included screen will not meet the requirements to show QR code ?
yes, the AB02’s screen is Too narrow.
QR code generation is possible on Heltec ESP32 kit that comes with OLED. However due to the display size limitation, the maximum number of characters that it can convert to a QR code is also much less. The tests I did so far could only code less than 15 characters. Here is the code that works. Courtesy: https://eugeniopace.org/qrcode/arduino/eink/2019/07/01/qrcode-on-arduino.html
Install this library: https://github.com/ricmoo/QRCode
#include "qrcode.h"
#include "heltec.h"
void setup() {
Serial.begin(115200);
Heltec.begin(true, false, true);
Heltec.display->clear();
// Create the QR code
QRCode qrcode;
const int qrcodeVersion = 3;
const int pixelsPerSquare = 2;
const int ecc_low = 0;
uint8_t qrcodeData[qrcode_getBufferSize(qrcodeVersion)];
qrcode_initText(&qrcode, qrcodeData, qrcodeVersion, ecc_low, "HELLO WORLD");
for (uint8_t y = 0; y < qrcode.size; y++) {
for (uint8_t x = 0; x < qrcode.size; x++) {
//If pixel is on, we draw a ps x ps black square
if (qrcode_getModule(&qrcode, x, y)) {
for(int xi = x*pixelsPerSquare + 2; xi < x*pixelsPerSquare + pixelsPerSquare + 2; xi++){
for(int yi= y*pixelsPerSquare + 2; yi < y*pixelsPerSquare + pixelsPerSquare + 2; yi++){
Heltec.display->setPixel(xi, yi);
}
}
}
}
}
Heltec.display->display();
}
void loop() {
}