Can anyone point me to an example of the use of the extendedtimer in VB? I am trying to set a 15 minute timer after an interrupt is fired to call on a function and maybe kill the timer before its expiration if an event is triggered. Any help is appreciated.
Thanks,
Mark
Extendedtimer
Started by marksmanaz, May 28 2012 08:14 AM
3 replies to this topic
#1
Posted 28 May 2012 - 08:14 AM
#2
Posted 28 May 2012 - 11:43 AM
Hi Mark,
Depending on the precision of the timer you can set a standard timer to test the TimeSpan from the point that you started the timer, resetting the start point and raising an event when it is reached.
So if you wanted to check every second then set the timer to 1 second then in the sub that it calls do a simple TimeSpan
Here is a link to TimeSpan
http://forums.asp.net/t/1386180.aspx/1
The second alternative it to start a new worker thread that checks the TimeSpan in a loop and resets the start point and raises an event when the time has expired.
Hope this helps
Cheers Pete.
Depending on the precision of the timer you can set a standard timer to test the TimeSpan from the point that you started the timer, resetting the start point and raising an event when it is reached.
So if you wanted to check every second then set the timer to 1 second then in the sub that it calls do a simple TimeSpan
Here is a link to TimeSpan
http://forums.asp.net/t/1386180.aspx/1
The second alternative it to start a new worker thread that checks the TimeSpan in a loop and resets the start point and raises an event when the time has expired.
Hope this helps
Cheers Pete.
I was going to change the world, then I discovered Netduino.
The world will have to wait.
The world will have to wait.
#3
Posted 28 May 2012 - 05:14 PM
Pete,
Thank You for your fast response. I actually was trying to do the time diff but from what I see NET MF does not have the NOW() function to record the current time. When I try VS2010 throws me this: "Error 1 'now' is not declared. It may be inaccessible due to its protection level."
I have tried to declare a variable at all levels for now() with no success. Am I missing something? I just assumed it was a bug or not available so I am trying to move forward.
I believe this function is referenced in system; correct?
Thanks,
Mark
#4
Posted 28 May 2012 - 05:51 PM
OK I got it; I wasn't being specific enough for vb net.
This works:
Dim start As DateTime = DateTime.Now
My plan was to get current time and add 15 minutes and loop thru until that time is reached. Any suggestions are welcome if there is a better way. Also I know that time keeping on the netduino plus is poor and for what I need it for an approximation is fine. 15 minutes give or take a minute is going to work for me.
Thanks again,
Mark
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users