Hi All,
I have been working on the software side of a pan tilt device which is designed to take a number of photos with a DSLR camera moving left to right, or right to left, then up the Y axis based on input from the serial monitor.
So the program basically waits for serial input, in the form of Starting X position, Starting Y position, Finishing X position, Finishing Y position and the focal length of the lense.
It uses all of this to work out the field of view of the lense, and then to determine how many photos will need to be taken (accounting for overlap) and how many degrees between each photo on the X and Y axis.
The idea is that I will use this with some stepper motors (when they arrive), however I do have a strange glitch in the code that I can't quite work out.
The code moves left to right on the X axis, then moves up on the Y, then right to left on the X axis then up on the Y and repeat. This is fine however for some reason at the end of the first X loop, it increments beyond where it should on the Y axis moving up, for example:
Moving to position (X,Y): 175,15
Moving to position (X,Y): 186,15
Moving to position (X,Y): 186,23
Moving to position (X,Y): 186,31
Moving to position (X,Y): 175,31
In the above, it should not be going to position 23 but rather jumping to 31 then going back on the X axis, is someone able to take a quick peek at my code and see if something jumps out in terms of what may be causing this.
I must apologize for the poorly written sketch, but many thanks for taking a look at this!