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

timer question


  • Please log in to reply
4 replies to this topic

#1 perkunas

perkunas

    Advanced Member

  • Members
  • PipPipPip
  • 108 posts

Posted 21 September 2012 - 09:33 PM

This is a little hard to explain so here go's I have light on for 16 hours off for 8 forever loop simple I have another loop that kills the 1st one in 14 days Is there a way to track the 1st loop My problem is that when the main loop happens the light may have already been on 0-16 hours no way of knowing. Would like to start it at the same time it left off. My thinking is, I probably need an external clock.

#2 perkunas

perkunas

    Advanced Member

  • Members
  • PipPipPip
  • 108 posts

Posted 21 September 2012 - 10:24 PM

Maybe instead of killing the thread, I could use a Thread.Suspend(); / Thread.Resume():

#3 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 22 September 2012 - 12:33 AM

This is a little hard to explain so here go's
I have light on for 16 hours off for 8 forever loop
simple
I have another loop that kills the 1st one in 14 days
Is there a way to track the 1st loop
My problem is that when the main loop happens the light may have already been on 0-16 hours no way of knowing.
Would like to start it at the same time it left off.
My thinking is, I probably need an external clock.

Perkunas,

I may have miss understood your question, but if I didn't I would would pick a loop with a time of say 1 minute. Then on each loop I would increment a counter.

In visual Basic something like this (most likely not correct, meant only to get you started)
dim OnCounter as integer = 0
dim LightOn as boolean = false

OnCounter = OnCounter + 1
LightOn = (OnCounter > 0) and (OnCounter < 961)
if OnCounter > 1440 then
OnCounter = 0
end if

Then use the OnCounter to control a relay for the light.

Also easy to do in C#

Hope this helps.
Chuck

#4 Geancarlo2

Geancarlo2

    Advanced Member

  • Members
  • PipPipPip
  • 70 posts

Posted 22 September 2012 - 01:36 AM

Given that your program knows when it is turning lights on or off, it's just a matter of storing what you did and when you did. If you know 100% sure that netduino will be working uninterrupted, you can probably use DateTime.Now and figure how to work your requirements out. Otherwise, you should consider getting a RTC chip with some memory+battery...

#5 perkunas

perkunas

    Advanced Member

  • Members
  • PipPipPip
  • 108 posts

Posted 22 September 2012 - 10:32 AM

OMG I love the loop timer Idea, create a 1min loop that counts genius. Accuracy is not that important, and a clock has issues to to be resolved. Problem is now we get into the realm of advanced programing, and for a little guy like me oh wow IDK. Tnx




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.