I finally got the curve calculating code working on the machine, so everything is now up on GitHub!
I got the straight line code (G-Code command 1) working quite quickly, but the curve code (G-Code commands 2 and 3) took quite a while to get sorted. I started off with a little Flash prototype as that was quickest and simplest to debug:
Then converted it into C, and tested it with a little console test program. This had quite a few problems I needed to fix before it would work, as my C is rather rusty:
And then duck taped a felt tip pen to the CNC machine for a quick test on the hardware:
Success! Can't wait to try it on some wood now! For the moment it only works on the XY axis, but the vast majority of curves would be on that plane anyway, so I'm not super keen to add support for the other axes just yet.
I would probably advise against trying to use the code as is since I wrote it for my specific machine and don't really want to develop it further than that (that's not really the fun bit for me). It is also still a work in progress and largely untested. It may come in handy to pick through for anyone else building something similar though, as I couldn't find many resources when I was writing it. The curves and lines and servo switching all took a fair amount of hunting around for ideas and trying things, since I wanted to do it without storing huge amounts of data in the Arduino memory.
The repository also includes my Unity scripts for generating G-Code and transmitting it to the Arduino:
These are very early versions and pretty rough around the edges but I plan to develop them a bit more to be more robust and useful as more than just testing tools.
I think before that though I need to make sure the hardware is reliable, and cut some more stuff to get more familiar with how to use the machine best.