Download Print this page

DAGU MR. Tidy User Manual page 12

Mr. tidy robotics

Advertisement

The last tab contains a conversion table of musical notes thanks to Brett Hagman. This can be used to
simplify generation of melodies for your robot and is used for the initial melody played when the robot begins
operation.
Program structure:
When you break the sample program down the structure is very basic. The program starts by including the
files that make up the tabs along with any library files required. Global variables are then defined. These
variables can be accessed from anywhere in the program.
The setup() function as the name suggest is used to setup the robot when the program first runs. The
interrupt pins are initialised and output pins are configured. By default, all pins start as input pins when the
robot is reset or first powered up. This prevents any accidental short circuits from occurring. The arm and
gripper limit pins have an internal 20K pullup resistor initialised.
After playing a simple melody to warn that the robot has activated the gripper and arm are reset to their
default positions and the robot is ready to begin operation.
The loop() function is the main core of the program and repeats continuously until the robot is shutdown or
reset. This function can be broken into several steps:
1. Check the timer and change the LED chase pattern if required.
2. Monitor the average battery voltage to determine if the charger has been connected.
3. Shutdown the robot if the battery charger is connected (Press reset after charging is finished).
4. Check the side and rear sensors to prevent a collision and operate/chase LEDs.
5. Monitor the front sensors and create a simple binary value of the readings compared to the average.
6. Perform 1 of 16 actions based on binary readings of the front sensors.
7. Determine if the robot has dropped an object and reset some variables if required.
By performing these seven basic steps repeatedly the robot will locate and pick up objects, attempting to sort
objects according to their colour. As this is a simple demonstration program there is no mapping involved
with the robot simply choosing a random direction to go in after picking up or setting down an object.
All other functions are called on from the setup() and loop() functions as required. The language reference
http://arduino.cc/en/Reference/HomePage
can be found here:
12

Advertisement

loading

Related Products for DAGU MR. Tidy