How big numbers can Arduino count down in a timer-program counting seconds?
I want to count down from 181440 and I can't get it to work
(with the code that works fine for counting down from 100 for example.)
I ask because I want to make sure, this has to do with the Arduino, right?
(And not with the code?)
thanx <3
Here is the code;
//Arduino Self-Timer
//T.K.Hareendran
//www.electroschematics.com
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int runTimer = 1;
int runFor = 10; // time in seconds
//int buzzerPin = 13;
//int relayPin=4;
int data = 0;
void setup() {
// pinMode(buzzerPin, OUTPUT);
// pinMode(relayPin,OUTPUT);
lcd.begin(16, 2);
}
void loop() {
if(runTimer == 1){
// digitalWrite(relayPin,LOW); // relay is OFF during countdown
/* *change to HIGH if you want the relay to be ON while countdowning */
lcd.clear();
//lcd.print("TIME LEFT");
//Start timer
timer();
} else {
// digitalWrite(relayPin,HIGH); // relay is ON when time expired
/* *change to LOW if you want the relay to be OFF when the time expired */
}
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("BOOM!");
delay(500);
lcd.clear();
delay(500);
lcd.setCursor(6,0);
lcd.print("BOOM!");
delay(500);
lcd.clear();
delay(500);
lcd.setCursor(10,0);
lcd.print("BOOM!");
delay(500);
lcd.clear();
delay(500);
lcd.print("BOOM!");
delay(500);
lcd.clear();
delay(500);
lcd.setCursor(3,0);
lcd.print("I WANT YOU");
delay(500);
lcd.setCursor(3,1);
lcd.print("IN MY WOMB");
delay(500);
}
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.