Hello can someone help me with code to arduino timer with 6 buttons for 15 , 30, 45, 60, 120 and 180 minutes and output would be 1 second pulse on one pin.
Post your code, otherwise we can't help you with it.
Don't forget the code tags.
i dont have the code yet, im not wery strong at programming, i thought that maybe someone can lead me to similar thing where i can customise the code to my needs.
Don't be lazy, do your own searching! If you can find 2 or 3 that have some or all of what you need, post links to them here and we can advise which would be the best starting point.
Paul
The problem is in that i havent found any of thatkind of projects,it seems that noone ever needed thing like that.
Break the problem down: blink without delay with some small modifications will give you your one pulse per second, and provide a backbone for all the other functions.
i found something that needs to be modified
unsigned long currentTime;
unsigned long loopTime;
void setup()
{
currentTime = millis();
loopTime = currentTime;
pinMode(12, OUTPUT); //Initialize pin 12 as status LED
pinMode(8, INPUT); // Our button pin
}
void loop()
{
if (digitalRead(8) == LOW) // Switch is closed to start LED timer
{
digitalWrite(12, HIGH); // LED comes On
currentTime = millis();
}
else //Hits each pass that switch is not pressed
{
if (currentTime >= (loopTime + 5000)); {
digitalWrite(12, LOW); // LED goes off
loopTime = currentTime; // Updates loopTime
}
}
}
if (currentTime >= (loopTime + 5000));
Yes, it does need modification.
Where did you find it?
i found it from arduino forum Using ardunio as a time delay relay - Programming Questions - Arduino Forum, but i need that it keeps giving the 1sec pulse for every 15 minutes or whatever button is pressed depending on that, i need to reset one circuit with that with different times
so modify it.
read, study and understand blink without delay.
read about INT unsigned int and long and such
set a separate counter for each time,
15 , 30, 45, 60, 120 and 180 minutes and 1 second pulse
when an event happens, (switch?) each counter would come into play.
on long events, I have used a clock, the old electric style with hands. turn the power on at the start, i will run for those times, at the end of the cycle, the power fails and when you come back you have an indicator of the length of time of operation.
used to do that to test how long a battery would last.
just giving you some clues.