PaulS:
I don't know if this is clear, or not: POST YOUR CURRENT CODE. ALL OF IT.If not, I can post more. But, don't make me do that.
OK
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
int sw = 3;
int led1 = 7;
int ledState1 = HIGH;
unsigned long previousMillis1 = 0;
long OnTime1 = 600000 ;
long OffTime1 = 3600000;
long secondd ;
long secondd1 = 60;
int allmint1 ;
int mint1 ;
int hours1 ;
void setup() {
Serial.begin(9600);
lcd.begin(20, 4);
pinMode(led1, OUTPUT);
lcd.setCursor(1, 0);
lcd.print("H :M :S");
pinMode(sw, INPUT_PULLUP);
}
void loop() {
unsigned long currentMillis = millis();
if (ledState1 == HIGH)
digitalWrite(led1, ledState1);
if ((ledState1 == HIGH) && (currentMillis - previousMillis1 >= OnTime1))
{
ledState1 = LOW;
previousMillis1 = currentMillis;
digitalWrite(led1, ledState1);
}
else if ((ledState1 == LOW) && (currentMillis - previousMillis1 >= OffTime1))
{
ledState1 = HIGH; previousMillis1 = currentMillis;
digitalWrite(led1, ledState1);
}
/////
if (currentMillis - secondd == 1000) {
secondd = currentMillis;
}
if ((secondd1 == 0)) {
secondd1 = 60;
}
else if (currentMillis - secondd == 0) {
secondd1--;
lcd.setCursor(1, 1); lcd.print(" :");
lcd.setCursor(1, 1); lcd.print(hours1);
lcd.setCursor(4, 1);
lcd.print(" :");
lcd.setCursor(4, 1);
lcd.print(mint1);
lcd.setCursor(7, 1);
lcd.print(" :");
lcd.setCursor(7, 1);
lcd.print(secondd1);
if ((ledState1 == HIGH)) {
lcd.setCursor(14, 1);
lcd.print(" ");
lcd.setCursor(10, 1);
lcd.print(" FAN ON ");
}
else if ((ledState1 == LOW)) {
lcd.setCursor(14, 1);
lcd.print(" ");
lcd.setCursor(10, 1);
lcd.print(" FAN OFF");
}
if (currentMillis == 1000 && ledState1 == HIGH) {
allmint1 = (OnTime1 / 60 / 1000) - 1;
}
else if ((currentMillis - previousMillis1 == 0 && ledState1 == HIGH)) {
allmint1 = (OnTime1 / 60 / 1000) - 1;
}
else if ((currentMillis - previousMillis1 == 0 && ledState1 == LOW)) {
allmint1 = (OffTime1 / 60 / 1000) - 1;
}
else if ((currentMillis - secondd == 0 && secondd1 == 0)) {
allmint1--;
}
hours1 = allmint1 / 60;
if ((hours1 < 1)) {
mint1 = allmint1;
}
else if ((hours1 >= 1)) {
mint1 = allmint1 - (hours1 * 60);
}
}
}
in this code i have countdown for ontime and of time of the fan
I want to increase and decrease ontime and of time using switches (this is not here in this code but i need your help to add this to my code) and your help to use EEPROM in this code