Gujarat, India
Offline
Newbie
Karma: 0
Posts: 11
|
 |
« on: February 25, 2013, 07:48:46 am » |
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
Brattain Member
Karma: 137
Posts: 19052
I don't think you connected the grounds, Dave.
|
 |
« Reply #1 on: February 25, 2013, 07:52:13 am » |
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
Brattain Member
Karma: 313
Posts: 35502
Seattle, WA USA
|
 |
« Reply #2 on: February 25, 2013, 07:53:55 am » |
What do you mean by "no input"? I think that pretty well sums up the semantic content of OPs posts.
|
|
|
|
|
Logged
|
|
|
|
|
Gujarat, India
Offline
Newbie
Karma: 0
Posts: 11
|
 |
« Reply #3 on: February 25, 2013, 07:55:08 am » |
no input means 0V at any pin
|
|
|
|
|
Logged
|
|
|
|
|
Gujarat, India
Offline
Newbie
Karma: 0
Posts: 11
|
 |
« Reply #4 on: February 25, 2013, 07:58:18 am » |
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
Brattain Member
Karma: 313
Posts: 35502
Seattle, WA USA
|
 |
« Reply #5 on: February 25, 2013, 07:58:56 am » |
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
Newbie
Karma: 0
Posts: 11
|
 |
« Reply #6 on: February 25, 2013, 08:01:20 am » |
Is there some other way to solve my problem without watchdog ???? please tell me
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 137
Posts: 19052
I don't think you connected the grounds, Dave.
|
 |
« Reply #7 on: February 25, 2013, 08:03:09 am » |
Is there something wrong with your punctuation keys? 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
Newbie
Karma: 0
Posts: 11
|
 |
« Reply #8 on: February 25, 2013, 08:06:24 am » |
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
Brattain Member
Karma: 137
Posts: 19052
I don't think you connected the grounds, Dave.
|
 |
« Reply #9 on: February 25, 2013, 08:08:43 am » |
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
Brattain Member
Karma: 313
Posts: 35502
Seattle, WA USA
|
 |
« Reply #10 on: February 25, 2013, 08:08:52 am » |
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
Newbie
Karma: 0
Posts: 11
|
 |
« Reply #11 on: February 25, 2013, 08:22:11 am » |
Thanks for information
let me try that out
does mills() work in background ?
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 313
Posts: 35502
Seattle, WA USA
|
 |
« Reply #12 on: February 25, 2013, 08:44:56 am » |
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
Tesla Member
Karma: 89
Posts: 6377
-
|
 |
« Reply #13 on: February 25, 2013, 08:46:53 am » |
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
Newbie
Karma: 0
Posts: 11
|
 |
« Reply #14 on: February 25, 2013, 11:55:09 am » |
thanks guys
i will work on it
|
|
|
|
|
Logged
|
|
|
|
|
|