#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define BUTTON_PIN 4
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define PRESCRIPT_COUNT 60
#define MAX_LENGTH 100
const char prescripts[PRESCRIPT_COUNT][MAX_LENGTH] PROGMEM = {
"Turn left at your next corner.",
"Remain silent for 12 minutes.",
"Discard one possession tonight.",
"Refuse the next invitation.",
"Move an object 3 cm right.",
"Face north at 3:14 PM.",
"Ignore one apology.",
"Speak only in questions.",
"Step over the next crack.",
"Close a door permanently.",
"Write a forgotten name.",
"Do not blink for 10 seconds.",
"Rearrange three items.",
"Decline symmetry.",
"Stand still for 27 seconds.",
"Avoid mirrors today.",
"Knock twice before entry.",
"Count backwards from 19.",
"Skip one routine action.",
"Break one harmless habit.",
"Offer help anonymously.",
"Walk slower than usual.",
"Change your path abruptly.",
"Delay one response.",
"Leave a note unsigned.",
"Refuse repetition.",
"Speak truth once only.",
"Move silently.",
"Avoid eye contact briefly.",
"Turn off one light early.",
"Destroy one small draft.",
"Fold paper precisely.",
"Stand facing a wall.",
"Disobey expectation.",
"Touch cold metal.",
"Hold breath briefly.",
"Observe without acting.",
"Open a window at dusk.",
"Say nothing at noon.",
"Wait 7 seconds before speaking.",
"Act gay",
"Dont talk about Riensang",
"Do a ranked match in JJS and win exact 1-2",
"Js kill yourself son",
"Crack Yan at Exactly 3 A.M",
"Drink the Amongus potion"
};
char chosenPrescript[MAX_LENGTH];
bool lastButtonState = HIGH;
int lastIndex = -1;
void setup() {
pinMode(BUTTON_PIN, INPUT_PULLUP);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
randomSeed(esp_random());
showStartup();
}
void loop() {
bool currentButton = digitalRead(BUTTON_PIN);
if (lastButtonState == HIGH && currentButton == LOW) {
delay(50);
selectPrescript();
scrambleText(chosenPrescript);
}
lastButtonState = currentButton;
}
void showStartup() {
display.clearDisplay();
display.setCursor(0, 0);
display.println("The prescript reader");
display.println("");
display.println("Press Button...");
display.display();
}
void selectPrescript() {
int index;
do {
index = random(0, PRESCRIPT_COUNT);
} while (index == lastIndex);
lastIndex = index;
strcpy_P(chosenPrescript, prescripts[index]);
}
void scrambleText(const char* text) {
int len = strlen(text);
for (int reveal = 0; reveal < len; reveal++) {
display.clearDisplay();
display.setCursor(0, 0);
for (int i = 0; i < len; i++) {
if (i <= reveal) {
display.print(text[i]);
} else {
display.print((char)random(33, 126));
}
}
display.display();
delay(30);
}
display.clearDisplay();
display.setCursor(0, 0);
display.println("PRESCRIPT:");
display.println("");
display.println(text);
display.display();
}