Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Extendedtimer


  • Please log in to reply
3 replies to this topic

#1 marksmanaz

marksmanaz

    Member

  • Members
  • PipPip
  • 15 posts

Posted 28 May 2012 - 08:14 AM

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

#2 Bainesbunch

Bainesbunch

    Advanced Member

  • Members
  • PipPipPip
  • 61 posts
  • LocationFrance

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.
I was going to change the world, then I discovered Netduino.
The world will have to wait.

#3 marksmanaz

marksmanaz

    Member

  • Members
  • PipPip
  • 15 posts

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 marksmanaz

marksmanaz

    Member

  • Members
  • PipPip
  • 15 posts

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.