#include <LiquidCrystal_I2C.h>
#include <stdio.h>
#include "relay.h"
const int lcdAddress = 0x27;
LiquidCrystal_I2C lcd(lcdAddress, 16, 2);
const String turnOn = "ON";
const String turnOff = "OFF";
void setup() {
Serial.begin(9600);
lcd.init();
lcd.backlight();
redirectLCDOutput();
printf(">> LED is OFF <<");
RelayInit();
RelayOff();
redirectSerialOutput();
printf("%s\n", "===== Commands =====");
printf("%s\n", "ON - turn on the relay");
printf("%s\n", "OFF - turn off the relay");
printf("%s\n", "(Status): The relay is currently turned off");
}
void loop() {
redirectLCDOutput();
if (Serial.available() > 0) {
String command = Serial.readStringUntil('\n');
if (command == "ON" || command == "on") {
RelayOn();
printf(">> LED is ON <<");
} else if (command == "OFF" || command == "off") {
RelayOff();
printf(">> LED is OFF <<");
}
}
}