#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Initialize LCD (Address 0x27 is standard, try 0x3F if text doesn't appear)
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int signalPin = A0; // The Signal Output Pin (Middle Pin)
void setup() {
lcd.init();
lcd.backlight();
// Professional Boot Sequence for Intern Report
lcd.setCursor(0, 0);
lcd.print("BREADBOARD-FREE");
lcd.setCursor(0, 1);
lcd.print("MENU SYSTEM v1.0");
delay(2000);
lcd.clear();
}
void loop() {
// Read the Signal Output Pin (0 to 1023)
int knobValue = analogRead(signalPin);
// Divide the 1024 range into 3 Menu Pages
// --- PAGE 1: 0 to 340 ---
if (knobValue < 341) {
lcd.setCursor(0, 0);
lcd.print("> SYSTEM STATUS ");
lcd.setCursor(0, 1);
lcd.print("State: ACTIVE ");
}
// --- PAGE 2: 341 to 682 ---
else if (knobValue >= 341 && knobValue < 682) {
lcd.setCursor(0, 0);
lcd.print("> MOMO ");
lcd.setCursor(0, 1);
lcd.print("Chowmein: ");
lcd.print(knobValue);
lcd.print(" "); // Spaces clear old digits
}
// --- PAGE 3: 683 to 1023 ---
else {
lcd.setCursor(0, 0);
lcd.print("> Pizza ");
// Map the signal to a percentage for the user
int percent = map(knobValue, 683, 1023, 0, 100);
lcd.setCursor(0, 1);
lcd.print("Level: ");
lcd.print(percent);
lcd.print("% ");
}
delay(100); // Prevents LCD "ghosting" or flickering
}