UK
Offline
Tesla Member
Karma: 89
Posts: 6400
-
|
 |
« Reply #15 on: February 08, 2013, 01:35:17 pm » |
We won't know until the OP replies, but I can't help feeling that there is some confusion between 2400 hours (ie midnight) and the need to allow for 24 hours in the day.
Yeah, the initial mention of 800,1200,2000,2400 Hrs does sound more like times in a 24-hour period rather than a 2400 hour period, but the code does definitely allow for 2400 hours rather than 24 hours. Perhaps the OP is confused about the distinction.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 21
|
 |
« Reply #16 on: February 08, 2013, 09:43:53 pm » |
Thanks all I don't want to change Hrs to Day I have to use Hr:min:sec so maximum of Hr is 2400 Hrs for usage. now I try to use button on board like this http://arduino-info.wikispaces.com/LCD-Pushbuttons
|
|
|
|
|
Logged
|
|
|
|
|
East Anglia (UK)
Offline
Edison Member
Karma: 49
Posts: 1435
May all of your blinks be without delay
|
 |
« Reply #17 on: February 09, 2013, 02:13:30 am » |
So, the alarm is to go off after 800, 1200, 2000 and 2400 hours.
This is going to take a long while to test !
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 21
|
 |
« Reply #18 on: February 14, 2013, 04:57:07 am » |
Hi all I want to add code ..is i want to use 5v from pin3, pin3=HIGH for count if(pin3==1){ static unsigned long lastTick = 0; if (millis() - lastTick >= 1000) { lastTick = millis(); second++; }
// Move forward one minute every 60 seconds if (second >= 60) { minute++; second = 0; // Reset seconds to zero }
// Move forward one hour every 60 minutes if (minute >=60) { hour++; minute = 0; // Reset minutes to zero }
if (hour >=2500) { hour=0; minute = 0; // Reset minutes to zero } }
it is not working my display is no counting 00:00:00 always My goal is use 5V from pin3 order for couning if pin3 = 0v , pin3 is stop counting and if pin3 = 5V is counting. What should i do new code ??
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 29
Posts: 1586
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #19 on: February 14, 2013, 06:27:00 am » |
So... if(pin3 == HIGH) count++; else do nothing.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 316
Posts: 35566
Seattle, WA USA
|
 |
« Reply #20 on: February 14, 2013, 06:56:50 am » |
if(pin3==1){ Do you have, somewhere above this, a line like: pins3 = digitalRead(state3); It seems silly to store a state in a variable named pin3. It seems silly to name a variable pin3, and then store the value 1 in it. Therefore, it seems silly to expect pin3 to equal 1.
|
|
|
|
|
Logged
|
|
|
|
|
UK
Offline
Tesla Member
Karma: 89
Posts: 6400
-
|
 |
« Reply #21 on: February 14, 2013, 07:03:18 am » |
So... if(pin3 == HIGH) count++; else do nothing.
if(digitalRead(pin3) == HIGH) count++;
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 29
Posts: 1586
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #22 on: February 14, 2013, 08:02:46 am » |
So... if(pin3 == HIGH) count++; else do nothing.
Its just pseudo code, he needs to fill in the gaps.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
UK
Offline
Tesla Member
Karma: 89
Posts: 6400
-
|
 |
« Reply #23 on: February 14, 2013, 08:51:09 am » |
Its just pseudo code, he needs to fill in the gaps.
Using the pin number instead of the value read from the pin is a very common mistake. Even if you meant it to be pseudo code (which is not obvious, since that is syntactically valid C++) it's not doing the OP any favors by encouraging them to make that mistake.
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 29
Posts: 1586
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #24 on: February 14, 2013, 09:01:12 am » |
Ok, I just thought he would be able to tell the difference between using the pin number and the actual value of the pin.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 21
|
 |
« Reply #25 on: February 14, 2013, 09:20:00 pm » |
Thanks all
I have done. ^ - ^
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 29
Posts: 1586
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #26 on: February 14, 2013, 09:22:54 pm » |
Is good yes?
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 21
|
 |
« Reply #27 on: February 15, 2013, 03:57:46 am » |
YES. ^ ^
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 21
|
 |
« Reply #28 on: February 22, 2013, 11:39:48 pm » |
I have new idea but i cant if (minute == 1) { switch (lcd_key) // depending on which button was pushed, we perform an action case btnLEFT: {for(j=0;j<1;j++) lcd.setCursor(0, 1); lcd.print(" Timer "); digitalWrite(led0, LOW); digitalWrite(led1, LOW); digitalWrite(led2, LOW); break; } } i want to press hold switch LEFT for 30 sec and then it is working go on if dont press hold it can't do that.
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 29
Posts: 1586
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #29 on: February 22, 2013, 11:53:15 pm » |
You have to use a timer. Press the button once to start the timer and then keep it held. Using "millis() - timer > 30000UL", it will check to see if the state has changed within that period. If it DOES change within that period, it will NOT do the action. Only when the first state and second state are equal will it do the action.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
|