#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
//DISP
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
// initialize with the I2C addr 0x3C (for the 128x64)
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
// Clear the buffer
display.clearDisplay();
// Display text
display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(SSD1306_WHITE); // White text
display.setCursor(0,0); // Start at top-left corner
display.println("StockApp");
display.display();
}
int randomNum(){
return random(10000000,99999999);
}
void loop() {
// put your main code here, to run repeatedly:
delay(2000); // this speeds up the simulation
// Clear the buffer
display.clearDisplay();
// Display text
display.setTextSize(1); // Normal 1:1 pixel scale
display.setTextColor(SSD1306_WHITE); // White text
display.setCursor(0,0); // Start at top-left corner
int code = randomNum();
String full = "https://ge.fi/secure?l=" + String(code);
display.println(full);
const char* fullChar = full.c_str();
display.display();
}