hello my friends,
my name is Ahmed Darwish. this is my first arduino program.
i want to make a countdown system for irrigation control.
the system goes as follows:
- the system is turned on.
- the system asks me to enter the time for countdown as hh:mm:ss
- i enter the values with keypad (4:3 or 4:4)
- i press # to enter the values to the memory
- the system asks me to enter the signal period as mm:ss
- i enter the values with keypad (4:3 or 4:4)
- i press # to enter the values to the memory
- the system starts to count down from hh:mm:ss i entered to 00:00:00
- the system starts to create a HIGH signal to control a relay for signal period mm:ss
- the system starts to count down from mm:ss i entered to 00:00
- the system makes a LOW signal to control a relay
- the system repeats to countdown hh:mm:ss again then signal period mm:ss over and over
- if i press the * any time the system resets
i got a code from:
http://tech-zen.tv/episodes/shows/make-it-work/episodes/countdown-timer-with-an-arduino-episode-42
i modified it, but could not complete the code. attached a file with the code
Can you help me to modify it .. please.
thanks alot
Countdown.txt (4 KB)
Please stop cross-posting. Other thread removed.
Note: you can post your code in the thread itself using code tabs. Just press the button which looks like </> and it will put in some tags for you. Then you can put your code in here and it will look like this:
Hello!
When you say 'modify' what do you want it to do exactly?
Sporech:
When you say 'modify' what do you want it to do exactly?
Actually, he told us. Add the posted list of features to the online code.
Well, there's a lot there. The basic sketch is
loop() {
if(im in time enter mode) {
do time enter thing
}
else {
do countdown thing
}
}
the countdown thing is reasonably simple.
void do countdown thing() {
if * is pressed {
turn everything off
go back to time enter mode
return
}
if time - start time < initial delay {
turn output off
if time is different to time last time I last executed this loop {
update countdown display
}
} else if time - start time < initial delay + signal period {
turn output on
if time is different to time last time I last executed this loop {
update countdown display
}
} else {
set start time to right now
}
}
The inputty thing is the most complicated bit. You'll want to break it up into "work out if there's been a keypress" and "do something with the key press" this means keeping track of which particular number is being input.