Mapping Robot 1.4: Code

Path Displayed

The C program, NavigateObstacles, is transferred to the Arduino Uno board via USB. It contains all of the instructions that control the robot’s motors, sensors, and data logging capabilities. You can copy and paste the code from below or download my original .ino file from the Dropbox link included. I’m also setting up a GitHub profile so that I can get feedback from readers in the future. Stay tuned!

I used the Processing programming language and IDE to write DisplayPathway, a program that communicates serially with the Arduino Uno and receives the position data recorded during the execution of NavigateObstacles. The program receives data in the form of (distance,angle) pairs that represent the robot’s movement vectors. DisplayPathway then calculates approximate stopping points along the robot’s path and plots lines between the points representing the robot’s approximate path (see Introduction).

Processing is an open source language based on Java, and a free IDE for OS X, Windows, or Linux can be downloaded here. I like Processing because its IDE behaves exactly in the same way as the Arduino IDE, and so learning and using both languages is quite easy. Documentation for the processing language can be found here.

See my github repository for the navigation code and the graphical display code: