diff --git a/.gitignore b/.gitignore index 1377554..8118027 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.swp +.idea* diff --git a/hot_fermentation.ino b/hot_fermentation.ino index e1a70b6..9a090e4 100644 --- a/hot_fermentation.ino +++ b/hot_fermentation.ino @@ -1,7 +1,7 @@ -#include #include #include #include +#include // Include the GyverOLED library // MAX6675 configuration int max_SO = 12; @@ -9,8 +9,8 @@ int max_CS = 10; int max_SCK = 13; MAX6675 thermocouple(max_SCK, max_CS, max_SO); -// LCD configuration via I2C -LiquidCrystal_I2C lcd(0x27, 16, 2); // Set the LCD I2C address +// OLED configuration +GyverOLED oled; // SSR pin configuration const int ssrPin = 7; @@ -53,11 +53,14 @@ const int ssrSwitchInterval = 1000; // SSR switching interval in milliseconds void setup() { pinMode(ssrPin, OUTPUT); Serial.begin(9600); - lcd.init(); - lcd.backlight(); - lcd.print("Starting..."); + oled.init(); // Initialize the OLED + oled.clear(); // Clear the display + oled.setScale(2); // Set text scale to 2 for better visibility + oled.print("Starting..."); + oled.update(); delay(2000); - + oled.setScale(0); // Set text scale to 2 for better visibility + // Begin the first phase phaseStartTime = totalStartTime = millis(); Setpoint = temperatures[0]; @@ -91,8 +94,8 @@ void loop() { if ((currentTime - phaseStartTime) / 1000 >= phaseDurations[currentPhase] * 60) { currentPhase++; if (currentPhase >= numPhases) { - lcd.clear(); - lcd.print("Complete"); + oled.clear(); + oled.print("Complete"); digitalWrite(ssrPin, LOW); // Turn off the heater return; // Stop further execution } @@ -100,22 +103,23 @@ void loop() { Setpoint = temperatures[currentPhase]; } - // Display data on the LCD - lcd.clear(); - lcd.setCursor(0, 0); - lcd.print(formatTime(totalElapsedTime)); - lcd.print(" ("); - lcd.print(formatTime(totalProcessTime)); - lcd.print(")"); + // Display data on the OLED + oled.clear(); + oled.setCursor(0, 0); + oled.print(formatTime(totalElapsedTime)); + oled.print(" ("); + oled.print(formatTime(totalProcessTime)); + oled.print(")"); - lcd.setCursor(0, 1); - lcd.print(currentPhase + 1); - lcd.print(". "); - lcd.print((int)Input); - lcd.print("C "); - lcd.print((int)Setpoint); - lcd.print("C "); - lcd.print(formatTime((phaseDurations[currentPhase] * 60) - ((currentTime - phaseStartTime) / 1000))); + oled.setCursor(0, 1); + oled.print(currentPhase + 1); + oled.print(". "); + oled.print((int)Input); + oled.print("C "); + oled.print((int)Setpoint); + oled.print("C "); + oled.print(formatTime((phaseDurations[currentPhase] * 60) - ((currentTime - phaseStartTime) / 1000))); + oled.update(); delay(1000); // Update every second } @@ -124,4 +128,4 @@ String formatTime(long seconds) { long mins = seconds / 60; int secs = seconds % 60; return (mins < 10 ? "0" : "") + String(mins) + ":" + (secs < 10 ? "0" : "") + String(secs); -} \ No newline at end of file +}