A simplified Artbot sketch

In the example below, the Artbot’s control is dramatically simplified. Instead of defining an array of rotations and straight-line movements, (as is used here) the below Arduino sketch reduces control over the Artbot to 4 parameters:

  1. The speed of the left wheel
  2. the distance travelled by the left wheel
  3. the speed of the right wheel
  4. the distance travelled by the right wheel

This produces curved patterns that have a genuine ’emergent’ quality, that is: it is difficult to predict what the Artbot will draw exactly.

Is this abstraction a “better” one? It is certainly more efficient in terms of code, but does it offer easier/clearer control to a set of parameters that translate easily to graphic forms of interest?

#include <AccelStepper.h>
#include <AFMotor.h>

// two stepper motors one on each port
AF_Stepper motor1(2048, 1);
AF_Stepper motor2(2048, 2);

// you can change these to DOUBLE or INTERLEAVE or MICROSTEP!
// wrappers for the first motor!
void forwardstep1() {
 motor1.onestep(FORWARD, SINGLE);
void backwardstep1() {
 motor1.onestep(BACKWARD, SINGLE);
// wrappers for the second motor!
void forwardstep2() {
 motor2.onestep(FORWARD, SINGLE);
void backwardstep2() {
 motor2.onestep(BACKWARD, SINGLE);

// Motor shield has two motor ports, now we'll wrap them in an AccelStepper object
AccelStepper stepper1(forwardstep1, backwardstep1);
AccelStepper stepper2(forwardstep2, backwardstep2);

void setup()


void loop()
 // Change direction at the limits
 if (stepper1.distanceToGo() == 0) stepper1.moveTo(-stepper1.currentPosition());
 // if (stepper2.distanceToGo() == 0) stepper2.moveTo(-stepper2.currentPosition());

The advantage with this code is that it requires no abstraction layer between the Artbot’s structural design (one pen in the middle of the axis between 2 wheels) and a pre-conceived idea of what should be drawn. Instead, the code offers control directly over the rotation of each wheel.  The user can then explore their own creative ideas by discovering what is possible through managing each wheel’s motion.