Adapted from code by Dave Turtle by Andy Smith for Falmouth University.
This is a Processing sketch to control a CNC machine (based on coreXY using RAMPS 1.4 and Marlin firmware) with a servo Z-axis. The machine holds a paint brush, and is controlled live via a graphics tablet. The drawing can be recorded to a file as raw Gcode that can be replayed to the machine.
Very much a work in progress.