Beekeepers Sun Tracking Solar Wax Melter Project - Arduino Uno

dannyf

Joined Sep 13, 2015
2,197
to fire off a process every 15 minutes that runs the motor to turn the unit until the LDRs are giving an equal output,
that's not materially different from what he has, with the added downside that if there is a failure (motor, or obstacles, etc.), the execution is stuck in there and nothing else gets done.
 

ronsoy2

Joined Sep 25, 2013
71
In any code writing project the first thing to do is a flow diagram of your desired function. First start with one box. Call it sun tracker. Then make more boxes each one showing something you need to do to track the sun. Then each box you have drawn, analyze exactly what it takes to do that function and draw more boxes each one defining what you have to do to get that box to work. Note that this is ALL IN WRITING and before you do any code at all. Once you get all the boxes defined, then begin linking them together in the order that they must go. Note that every single logical step must be defined. Every test, branch, increment, decrement, etc. must be defined. (more little boxes) In the end you will be able to predict exactly what your program will do, before you take on the task of implementing the code for each box. Trying to "hack" code to do any but the most simple function will always result in major frustration. Once you master the art of doing a flow diagram of your functions you will be able to easily write some amazingly complex programs that will be very close to working the first time!
 

djsfantasi

Joined Apr 11, 2010
9,237
It doesn't have to be a flow diagram. You can get the same effect by creating an outline of what your program does. The process is similar to what @ronsoy2 has described, but it's written in natural language. Title your objective. Break it into major tasks. Further break that down, until you are at a level of detail that described everything and you understand. Some call this pseudo-code.
 

PhilTilson

Joined Nov 29, 2009
155
that's not materially different from what he has, with the added downside that if there is a failure (motor, or obstacles, etc.), the execution is stuck in there and nothing else gets done.
On the contrary! He says "Biggest issue I have right now is in the tolerance portion...servo seems only to correct/drive to the outer limit of tolerance so it is constantly trying to correct itself. I have tried several ways to try and drive it to the middle point or zero point of tolerance, with no luck." I don't see any reason to have the servo hunting this way and that when it only ever has to move in one direction!

And I don't understand the second part of your comment. If the motor fails in ANY of the proposed solutions, or 'obstacles etc' get in the way, then, as you say, "the execution is stuck in there and nothing else gets done". I am constantly amazed at how people seem to strive for the most complicated solutions on this forum, rather than just getting down to the simplest answer that meets the objective.

Any damned fool can make life complicated! :D
 
Top