Hi,
I have a very simple program that times in seconds, I have tried everything I can to change to timing in minutes with no success, can anyone put me right please?
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define lcd_end 16
#define lcd_address 0x27
#define lcd_lines 2
LiquidCrystal_I2C lcd(lcd_address, lcd_end, lcd_lines);
int runTimer = 1;
int runFor = 60; // time in seconds
int buzzerPin = 13;
int relayPin=4;
int data = 0;
void setup() {
lcd.begin();
lcd.backlight();
lcd.home();
lcd.print("Timing Test");
delay(3000);
}
void loop() {
if(runTimer == 1){
digitalWrite(relayPin,LOW);
lcd.clear();
lcd.print("TIMER=");
//Start timer
timer();
} else {
digitalWrite(relayPin,HIGH);
}
runTimer = 0;
lcd.noDisplay();
delay(250);
for(int duration = 0; duration < 100; duration ++){
digitalWrite(buzzerPin, HIGH);
delayMicroseconds(500);
digitalWrite(buzzerPin, LOW);
delayMicroseconds(500);
}
lcd.display();
delay(250);
}
void timer() {
for(int timer = runFor;timer > 0; --timer){
if(timer >= 10) {
lcd.setCursor(6,0);
} else {
lcd.setCursor(6,0);
lcd.print("0");
lcd.setCursor(7,0);
}
lcd.print(timer);
lcd.print(" SECOND!");
delay(1000);
}
lcd.setCursor(0,0);
lcd.clear();
lcd.print(" TIMER ALERT!");
}