A simple Python drawing program
Now that the robot can draw, you can add a simple graphical program that allows you to draw on the screen and then output this set of points to the drawing robot. Let's start with a simple draw program that is based on pygame:
When you run this program, either directly with a monitor and keyboard connected to Raspberry Pi or with the VNC Server viewer, you will see the following:
As you move the mouse in the draw window, you will notice the x and y location print in the terminal window. What you'll now do is save the robot arm control code in a library that can be called directly from the draw program. Here is the library code:
The following is the new draw code with the library connected:
Now, you can draw on the canvas and your robot arm will follow that set of motions. Of course, drawing is just one activity that your robot arm can tackle, there are myriad other activities that can utilize your robot arm.