[Tutor] Pen plotter data format
Phil
phillor9 at gmail.com
Fri Mar 31 21:21:09 EDT 2023
This is probably an off-topic question but I cannot think of another
group that may offer any help. All of the Python software is self-written.
Briefly, my laptop reads a gcode file and extracts the x any y
coordinates into two lists (one x and one y). The pen-up and pen_down
commands are not currently saved. The laptop then sends the x and y
coordinates to the micro-controller one at a time until the lists are
empty. The controller expects and waits for three bytes of x values and
then three bytes of y values in that order.
I'm thinking that a better approach might to send an x byte, for
example, like this "x, 123" and have the micro-controller separate the
value. Currently, the micro-controller only accepts data and moves the
motors and doesn't perform any processing.
Something like this might be better:
if cmd starts with 'x';
strip off the coord value
run the motor to that coord
if cmd starts with 'y':
etc
if cmd starts with 'z':
lift or lower pen
I'm still not sure how the laptop should handle the 'z' (pen-up)
commands because they don't fit neatly into the same x and y pair
pattern. Maybe the laptop should just parse the gcode file one line at a
time and then send the complete line to the micro-controller for
processing until the end of the file is reached? That would mean that
all sent bytes would have to be the same length but I could add padding
as I'm currently doing.
I don't know what format pen plotters normally receive their data in and
I'm hoping that someone may know. An Internet search hasn't helped so far.
--
Regards,
Phil
More information about the Tutor
mailing list