Loading...
Pages: [1]   Go Down
Author Topic: HELP !!!! Watchdog timer in Arduino mega 2560  (Read 324 times)
0 Members and 1 Guest are viewing this topic.
Gujarat, India
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello every one

Can some one help me out in how to use watch dog timer in an program

I want that if there is no input on pin A0 for 5 sec a subroutine should run(i.e. led on pin 13 should be ON)
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 137
Posts: 19052
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I want that if there is no input on pin A0
What do you mean by "no input"?
Logged

Pete, it's a fool looks for logic in the chambers of the human heart.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 313
Posts: 35502
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What do you mean by "no input"?
I think that pretty well sums up the semantic content of OPs posts.
Logged

Gujarat, India
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

no input means 0V at any pin
Logged

Gujarat, India
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Actually i have made an home automization project

in my project i am using resistive touch screen


so i want that then there is no input from my touch screen pin for  5 sec i want to run a particular subroutine.

hope this makes my problem more clear
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 313
Posts: 35502
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
no input means 0V at any pin
Not in general it doesn't. 0V at an analog pin may be perfectly reasonable.

Why do you think you need to use the watchdog? More people get bit by watchdogs than are protected by them.
Logged

Gujarat, India
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there some other way to solve my problem without watchdog ???? please tell me
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 137
Posts: 19052
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there something wrong with your punctuation keys?

Quote
Is there some other way to solve my problem
If we knew what your problem was, probably, yes.
Logged

Pete, it's a fool looks for logic in the chambers of the human heart.

Gujarat, India
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

sorry for the punctuation keys



my problem is that


if there is no signal from my touch screen for 5 sec i want to run a particular subroutine

hope you get my problem
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 137
Posts: 19052
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Every time you get input from the touch screen, note the time (using "millis")
Every time through your main background loop, check the current time, and see if it is more than 5000 milliseconds since the noted time.
Logged

Pete, it's a fool looks for logic in the chambers of the human heart.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 313
Posts: 35502
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
so i want that then there is no input from my touch screen pin for  5 sec i want to run a particular subroutine.
Every time there is input, reset the time when input occurred.

Periodically, see if now minus then exceeds some interval. If so, call the routine. No chain, no dog-food bowl, no dog food, no pooper scooper, no rabies shots.
Logged

Gujarat, India
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for information


let me try that out

does mills() work in background ?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 313
Posts: 35502
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
does mills() work in background ?
No, but that's OK since there is no "background". The Arduino doesn't have an operating system, and only one process space.
Logged

UK
Offline Offline
Tesla Member
***
Karma: 89
Posts: 6377
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

does mills() work in background ?

I don't know what you mean by that, but millis() works in setup() and loop() and code called from them if that's what you're asking. If in doubt, try it - there are plenty of examples showing how millis() can be used.
Logged

Gujarat, India
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks guys

i will work on it
Logged

Pages: [1]   Go Up
Print
 
Jump to: