Shop OBEX P1 Docs P2 Docs Learn Events
Storing variables at specific time intervals and retreiving them on the same time the next day. — Parallax Forums

Storing variables at specific time intervals and retreiving them on the same time the next day.

This may sound a bit confusing, but I have my solar panel array tracking the sun using the Prop. Everything works great, but I want to add an extra feature that will save positions from a good sunny day at specific times and if it is cloudy the next day, the data will be pulled from whatever was saved at that specific time the last time it was sunny and the panels will track to the best position. It's kind of hard to track the sun on a cloudy day.....

What I was thinking was use an array for the East and West path, and another array for the Up and Down path. I have the Prop communicating with my web server in 30 second intervals or so requesting for the updated time in the format of (H = 22, M = 15, S = 35) which would be 10:15pm and 35 seconds. I was hoping to save a 24 hour path that the panels can follow if it is cloudy or partly cloudy. I figure 10 minute increments would be good for this. So basically, there will be 6 slots per hour and over 24 hours, there will be 144 possible variables for each path. The problem I am having besides a huge brain fart is how to convert any time of the day to equal the correct array index (0 through 144).

Comments

  • (hour * 6) + (minutes / 10) ?
  • Well... That was simple and will probably work exactly how I need. Let me give it a go and see what happens.
  • I do believe it worked :) Thank you for helping me!
  • In the irrigation industry we used minutes past midnight as the starting point for watering cycles. The calculation is hours * 60 + minutes. Using your 10-minute interval and dividing minutes past midnight by 10, you get exactly as Tom suggested. If you can use a word instead of a byte to store the time, you could drop the division. The additional resolution would allow you finer control during hours of weak sunlight (dawn and dusk) which might allow you to maximize collection.
Sign In or Register to comment.