Timing
calebcl34
Posts: 2
Currently in Engineering class I am making a solar tracker, which finds the spot where it can obtain the most amount of solar energy by using a photoresistor, and follows the sun until the sun goes down. My problem is that my program only lets my solar panel spin one direction. Does anyone have a program that would make it so once it reaches a certain time limit set, such as 6 hours, it turns back the other direction? If I leave it the way it is, the wires I have that are connected to the Board of Education will wrap around the post I have holding the solar panel up and screw it up. Help me please!
Comments
Or, if the photoresistor has a very high value when it gets dark (compared to any time it's daylight), use that value to trigger the runback. This assumes of course that your motor can run in both directions. Maybe get the light-sensing system to slide under a cover as the system gets to the 'late-day' postion.
If you have to add a clock, it also gives you the opportunity to have the system detect long periods of cloud cover and 'bump' the system along so it will be in approximately the right position when the sun comes out again.
Without a clock, 6 hours can be timed this way:
Create a subroutine that takes 15 seconds to complete. Perhaps several PAUSE statements.
From the main program, goto the subroutine then return.
Count how many times you go to the subroutine.
When the count reaches 1440, you've timed 6 hours.
If you need your main program to do things faster than every 15 seconds, just make the subroutine shorter and count more of them.
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
Caleb
Jeff T.