Created
March 2, 2021 02:03
-
-
Save ByronScottJones/f2c4b96048c1dd445c652986c8705f14 to your computer and use it in GitHub Desktop.
ESP32 TTGO QRCODE based access
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <TFT_eSPI.h> | |
#include <SPI.h> | |
#include "qrcode.h" | |
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library | |
void setup(void) { | |
// Create the QR code | |
QRCode qrcode; | |
uint8_t qrcodeData[qrcode_getBufferSize(1)]; | |
qrcode_initText(&qrcode, qrcodeData, 1, 0, "[192.168.1.12](https://192.168.1.12)"); | |
tft.init(); | |
tft.setRotation(1); | |
int QRxBegin = 75; | |
int QRyBegin = 23; | |
int QRmoduleSize = 4; | |
tft.fillScreen(TFT_WHITE); | |
// Draw QR code | |
for (uint8_t y = 0; y < qrcode.size; y++) { | |
// Each horizontal module | |
for (uint8_t x = 0; x < qrcode.size; x++) { | |
if(qrcode_getModule(&qrcode, x, y))tft.fillRect(QRxBegin+ x*QRmoduleSize, QRyBegin + y*QRmoduleSize, QRmoduleSize, QRmoduleSize, TFT_BLACK); | |
} | |
} | |
} | |
void loop() { | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Original source: https://www.reddit.com/r/esp32/comments/lvlhl1/qr_code_for_esp32_web_server/
Reddit