#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <qrcode.h>
// OLED display dimensions
#define OLED_WIDTH 128
#define OLED_HEIGHT 64
// OLED display object
Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT, &Wire, -1);
void setup() {
// Initialize the OLED display
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
creditsPage("https://www.instagram.com/p/DCvOtfPzVn9/?next=%2F");
}
void loop() {}
void creditsPage(const char* text) {
QRCode qrcode; //object
uint8_t qrcodeData[qrcode_getBufferSize(3)]; //Define the size of the QR code
qrcode_initText(&qrcode, qrcodeData, 3, 0, text);
display.clearDisplay();
int scale = min(OLED_WIDTH / qrcode.size, OLED_HEIGHT / qrcode.size); // Calculate the scale factor
int shiftX = 70; //Right justified
int shiftY = 0; //vertical shift
// Draw the QR code on the display
for (uint8_t y = 0; y < qrcode.size; y++) {
for (uint8_t x = 0; x < qrcode.size; x++) {
if (qrcode_getModule(&qrcode, x, y)) {
display.fillRect(shiftX+x * scale, shiftY + y*scale, scale, scale, WHITE);
}
}
}
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(10, 0);
display.print("About:");
display.drawLine(10, 8, 40, 8, 1);
display.setCursor(0, 14);
display.print("-BajaBlstrs");
display.setCursor(0, 24);
display.print("-David Z.");
display.setCursor(0, 34);
display.print("-Eugenio S.");
display.display();
}