#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define RELAY_PIN 10
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
int onTime = 5000;
int offTime = 300000;
void setup() {
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
delay(2000);
// initialize digital pin LED_BUILTIN as an output.
pinMode(RELAY_PIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.setTextSize(1);
display.print("TEMP ");
display.print(" HUMI ");
display.print(" VPD ");
display.println(" DLI");
display.print("23.0 ");
display.print(" 65.2 ");
display.print(" 1.2 ");
display.println(" 30.3");
display.setCursor(0, 20);
display.println("TARGET PH");
display.println("ACTUAL PH = 1.3");
display.setCursor(27, 55);
display.println(" TEMP = 23.0");
display.display(); // wait for a second
digitalWrite(RELAY_PIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(onTime); // wait for a second
digitalWrite(RELAY_PIN, LOW); // turn the LED off by making the voltage LOW
delay(offTime);
}