Software Control of a Microprocessor: Arduino

Software Control of the 2D Plotter

Now that we have a plotter that makes a square pattern, it is time to see how to change the instructions that drive the motors. The software we use is Arduino.  This software should already be downloaded to the laptops we are using from https://www.arduino.cc/en/Main/Software

If you want to load this on your own computer, look for the download section that looks like this:

Select the appropriate system that matches your laptop and it will download.  When complete you will see the Arduino symbol (the sideways 8 with a - and + inside it).  Click on the program and you will see the following window:

This is called a sketch box.  This is where the C++ programming will be entered. You can type directly in the box.  Shown here is the sketch that was uploaded to your Arduino.  At this point we won't explain the code, instead, we will make some changes and discover what happens.

Examine the sketch below. You should have this file on your laptop labeled as sequence box for plotter.   If you do not have the file, you can copy the code at the end of the page and paste it into the screen. 

Change the value of t by retyping the line:  int t=200;   to int t=400;

When you are done typing the code, you need to compile.  Compiling is a process the software does to convert the typed instructions into machine language that the Arduino can understand.  To compile, click on the left hand upper corner that has a green check mark.  The software will work and then give a message at the bottom that either it is complete (green print) or that there is an error (red print).

If you have a green light, you can now upload the program to the Arduino.  If you have an error, check with a programming expert to see what your problem is.

To upload, connect your Arduino to the cable and USB port on the laptop.  Make sure your 9 volt power supply is either disconnected or turned off.

Return to your sketch and look at the menu bar once again.

Find the arrow next to the check in the upper left hand corner.  This is the upload button.  Press this to move the code to the Arduino.  You should see an LED on the Arduino board flash as the program is loaded.

Testing

Unplug the cable to the computer and attach the 9 volt power supply. Turn on the 2D plotter power supply and then turn on the 9 volt supply of the Arduino. Determine what happens to your plotter when a longer delay is used (the higher t value).   

If you have been successful with this set of instructions and changing and uploading software, you are ready to start changing other code and then inventing your own plotter pattern.  As an example, load the following sketch into your Arduino:  Box Sketch

After you see how this sketch works, change some variables to see what happens!  

RETURN to LIFE in 3D