Programming Commands Quick Reference Guide

Jump to inputBox

Jump to voiceControl

Jump to colorSensor

Jump to gridEye IR Sensor

Jump to Sensors

mimicArm/tinyBot

robot.h is the mimicEducationalRobots Arduino library (for use with Arduino Uno R3 or compatible), specially designed to simplify interacting with your mimicArm robot.  The library can be downloaded here, and each available command is summarized below.

Installation and Use

Copy robot.h and robot.cpp into your "libraries" folder in your Arduino sketchbok, then put:

#include <robot.h>

in your sketch header to use these commands.

Functions are shown in ORANGE, inputs in italics, and constants in BLUE. A “/” indicates limited options are accepted, a “,” indicates more than one input is used and should be included in the code. All inputs are case sensitive.

 

robotActivate();

robotMode(arduino/manual);

robotMove(channel, position);

robotGrab(force);

robotJog(channel, position change);

robotPosition(channel);

gripperMove(position);

gripperPosition();

gripperForce();

 

int robotActivate();

Sets up Arduino to communicate with mimicArm and puts mimicArm in Arduino mode (manual controller will be ignored). Returns 0 if successful or greater than zero if unsuccessful. mimicArm’s control circuit board must be connected and powered for robotActivate() to successfully execute.

 

int robotMode(arduino/manual);

Sets mimicArm to receive movement commands from either the mimicArm manual controller (manual) or from the Arduino (arduino). Returns 0 if successful or greater than zero if unsuccessful. mimicArm’s control circuit board must be connected and powered to successfully execute.

 

int robotMove(channel, position);

Moves a single join of mimicArm to a commanded position if mimicArm is in arduino mode. Accepts channel from 1 to 3, and position from 0 to 255. Values for channel outside this range are accepted without error but will not move mimicArm. Values of position outside this range are truncated to the maximum or minimum values. Returns 0 if successful or greater than zero if unsuccessful. mimicArm’s control circuit board must be connected and powered to successfully execute.

 

int robotGrab(force);

Commands mimicArm’s gripper to apply a specified force if mimicArm is in arduino mode. Accepts values form -127 to 127, with positive values applying a closing force and negative values applying an opening force. Values of force outside this range are truncated to the maximum or minimum values. Returns 0 if successful or greater than zero if unsuccessful. mimicArm’s control circuit board must be connected and powered to successfully execute.

 

int robotJog(channel, position change);

Moves a single join of mimicArm a specified amount from its current position if mimicArm is in arduino mode. Accepts channel from 1 to 3, and position change from -255 to 255. Values for channel outside this range are accepted without error but will not move mimicArm. Values of position change outside this range are truncated to the maximum or minimum values. Note that the robot cannot be moved beyond absolute positions between 0 and 255 for any channel. Returns 0 if successful or greater than zero if unsuccessful. mimicArm’s control circuit board must be connected and powered to successfully execute.

 

int robotPosition(channel);

Returns the current position of one channel of the robot in both arduino and manual modes. Range of responses is 0 to 255. Accepts channel from 1 to 3. Values for channel outside this range are accepted without error but will return zero. mimicArm’s control circuit board must be connected and powered to successfully execute.

 

int gripperMove(position);

Commands mimicArm’s gripper to a specified position if mimicArm is in arduino mode, and will apply maximum gripper force to attempt to achieve the commanded position. Accepts values form 0 to 255. Values of position outside this range are truncated to the maximum or minimum values. Returns 0 if successful or greater than zero if unsuccessful. mimicArm’s control circuit board must be connected and powered to successfully execute. (NOTE::Sends grip force to tinyBot, which does not have a gripper position feedback.)

 

int gripperPosition();

Returns the current position of the robot gripper in both arduino and manual modes. Range of responses is 0 to 255. mimicArm’s control circuit board must be connected and powered to successfully execute. (NOTE::Returns grip force to tinyBot, which does not have a gripper position feedback.)

 

int gripperForce();

Returns the current force applied by the robot gripper in both arduino and manual modes. Range of responses is -127 to 127, with negative numbers indicating gripper-opening force and positive numbers indicating gripper-closing force. mimicArm’s control circuit board must be connected and powered to successfully execute.

Jump to mimicArm

Jump to inputBox

Jump to voiceControl

Jump to colorSensor

Jump to gridEye IR Sensor

Jump to Sensors


inputBox

robotInputs.h is the mimicEducationalRobots Arduino library (for use with Arduino Uno R3 or compatible), specially designed to simplify interacting with your mimicArm robot.  The library can be downloaded here, and each available command is summarized below.

Installation and Use

Copy robot.h and robot.cpp into your "libraries" folder in your Arduino sketchbok, then put:

#include <robotInputs.h>

in your sketch header to use these commands.

Functions are shown in ORANGE, inputs in italics, and constants in BLUE. A “/” indicates limited options are accepted, a “,” indicates more than one input is used and should be included in the code. All inputs are case sensitive.

inputBoxActivate();

readButton(button number);

readPot();

readForce();

readMic();

redLED(brightness);

greenLED(brightness);

blueLED(brightness);

openReadSD(file number);

openWriteSD(file number);

recordSD();

playSD();

closeSD();

availableSD();

IRavailable();

readIR();

inputBoxVersion();

 

void inputBoxActivate();

Sets up Arduino to communicate with inputBox by staring the I2C bus using the "wire" library. There is no return, and no communication with the inputBox occurs with this command. No other inputBox command will work unless inputBoxActivate() is called, but commands may automatically call inputBoxActivate() depending on library version.

int readButton(button number);

Reads one of the four red buttons on the face of the inputBox, or the Great Big Button if connected at the inputBox the button headers. button number is number 1 through 4, for each of the four buttons on the inputBox. Function returns "0" or "FALSE" if the button is not pressed, and "1" or "TRUE" if the button is pressed. Common usage would be if(readButton(1)){user code};

int readPot();

Reads the analog value of the potentiometer on the inputBox. Returns and integer value from 0 to 255, representing the full sweep of the potentiometer. The function can be used directly in other funcitons, such as robotMove(1, readPot());

int readForce();

Reads the analog value of the force sensitive resistor on the inputBox. Returns and integer value from 0 to 255, representing the full range of the force sensor. The function can be used directly in other funcitons, such as robotGrab(readForce());

int readMic();

Reads the analog value of the microphone on the inputBox. Returns and integer value from 0 to 255, representing the full range of the microphone. The function can be used directly in other funcitons, such as robotGrab(readMic());

int redLED(brightness);

Set the red portion of the RGB LED on the input box to an integer value from 0 to 255, representing the full range of the LED. The function returns 0 if successful,  or an error code if not. The return is only useful for debugging, and is not required in normal use. You can make other colors by combining the three colors of the RGB LED.

int greenLED(brightness);

Set the green portion of the RGB LED on the input box to an integer value from 0 to 255, representing the full range of the LED. The function returns 0 if successful,  or an error code if not. The return is only useful for debugging, and is not required in normal use. You can make other colors by combining the three colors of the RGB LED.

int blueLED(brightness);

Set the blue portion of the RGB LED on the input box to an integer value from 0 to 255, representing the full range of the LED. The function returns 0 if successful,  or an error code if not. The return is only useful for debugging, and is not required in normal use. You can make other colors by combining the three colors of the RGB LED.

int openReadSD(file number);

Open a file number (1 to 37) to read from the SD card. This command must be executed before the file can be "played", and closeSD() will close the file. The function returns 0 if successful,  or an error code if not. The return is only useful for debugging, and is not required in normal use. 

int openWriteSD(file number);

CAUTION:: THIS COMMAND WILL DELETE THE FILE CALLED. THERE IS NO WAY TO APPEND TO AN EXISTING FILE. Execute this command to open a file (numbered 1-37) for writing. The program must execute closeSD() before the file is saved. The function returns 0 if successful,  or an error code if not. The return is only useful for debugging, and is not required in normal use. 

int recordSD();

This function requires that the SD file be opened by openWriteSD(file number) before it can execute. This command records the robot position and grip force at the instant that it is called. Call the function repeatedly to record robot motions. The program must execute closeSD() before the file is saved. The function returns 0 if successful,  or an error code if not. The return is only useful for debugging, and is not required in normal use. 

int playSD();

This function requires that the SD file be opened by openReadSD(file number) before it can execute. This command moves the robot to the robots position at the instant that it was recorded. Call the function repeatedly to play back robot motions. Each call will execute the next position in sequence. The function returns 0 if successful,  or an error code if not. The return is only useful for debugging, and is not required in normal use. 

int closeSD();

This function closes the previously opened file, and in the case of write files saves the result. The function returns 0 if successful,  or an error code if not. The return is only useful for debugging, and is not required in normal use. 

int availableSD();

This function returns the number of bytes still available in the opened SD file. When playing back a set of motions using playSD(); this function can be used to determine if the end of the file has been reached.

int IRavailable();

This function returns the number of bytes available in the IR Remove Control buffer. This function is generally called before calling readIR(); to ensure that useful data is available, such as if(IRavailable()) readIR();

int readIR();

Returns the button number of the IR remote control.

int inputBoxVersion();

Returns the firmware version of the inputBox.

Jump to mimicArm

Jump to inputBox

Jump to voiceControl

Jump to colorSensor

Jump to gridEye IR Sensor

Jump to Sensors


voiceControl

robot.h is the mimicEducationalRobots Arduino library (for use with Arduino Uno R3 or compatible), specially designed to simplify interacting with your voice control module.  The library can be downloaded here, and each available command is summarized below.

Installation and Use

Copy robot.h and robot.cpp into your "libraries" folder in your Arduino sketchbok, then put:

#include <robot.h>

in your sketch header to use these commands.

Functions are shown in ORANGE, inputs in italics, and constants in BLUE. A “/” indicates limited options are accepted, a “,” indicates more than one input is used and should be included in the code. All inputs are case sensitive.

voiceActivate();

voiceSetGroup(group);

voiceEnable();

voiceDisable();

voiceRecognize();

voiceAvailable();

int voiceActivate();

Required before interaction with the voiceControl module can perform any other activity. This command starts the software serial port that the voiceControl module uses to communicate. Returns success/failure status.

int voiceSetGroup(group);

The voiceControl module contains 64 groups of sentences, but can only interpret one group at a time. This function sets the group and returns a success/failure status.

int voiceEnable();

This function tells the voiceControl module to start listening. No commands will be received unless this function has been called first.

 

int voiceDisable(); 

Tell the voiceControl module to stop listening. If this function is called no commands will be received by the module.

int voiceRecognize();

Returns the phrase number from the selected group. Only returns a phrase if one has been received, otherwise will return an error value.

int voiceAvailable();

Determine if the voiceControl module has received a recognized voice command. Generally called before voiceRecognize();

Jump to mimicArm

Jump to inputBox

Jump to voiceControl

Jump to colorSensor

Jump to gridEye IR Sensor

Jump to Sensors


colorSensor

robotInputs.h is the mimicEducationalRobots Arduino library (for use with Arduino Uno R3 or compatible), specially designed to simplify interacting with your various sensors.  The library can be downloaded here, and each available command is summarized below.

Installation and Use

Copy robotInputs.h and robotInputs.cpp into your "libraries" folder in your Arduino sketchbok, then put:

#include <robotInputs.h>

in your sketch header to use these commands.

Functions are shown in ORANGE, inputs in italics, and constants in BLUE. A “/” indicates limited options are accepted, a “,” indicates more than one input is used and should be included in the code. All inputs are case sensitive.

colorSensorEnable();

getSensorRed();

getSensorGreen();

getSensorBlue();

getSensorClear();

rawSensorRed();

rawSensorGreen();

rawSensorBlue();

getSensorColor();

setColorSensorGain(gain);

setColorSensorIntegration(integration);

void colorSensorActivate();

Wakes the color sensor from sleep mode and allows sensor to start acquiring colors. Must be called before any other function, and usually called in setup(){ }.

int getSensorRed(); and int rawSensorRed();

getSensorRed() returns the value of the red component of light reflected from the object in front of the sensor, from 0 to 255. Can be used directly with the inputBox through redLED(getSensorRed());

rawSensorRed() returns the raw value of the red component of light, without adjusting for overall illumination. rawSensorRed() will return different values as the ambient light rises and falls, with getSensorRed() will remain relatively constant

int getSensorGreen(); and int rawSensorGreen();

getSensorGreen() returns the value of the green component of light reflected from the object in front of the sensor, from 0 to 255. Can be used directly with the inputBox through GreenLED(getSensorGreen());

rawSensorGreen() returns the raw value of the red component of light, without adjusting for overall illumination. rawSensorGreen() will return different values as the ambient light rises and falls, with getSensorGreen() will remain relatively constant.

int getSensorBlue(); and int rawSensorBlue();

getSensorBlue() returns the value of the blue component of light reflected from the object in front of the sensor, from 0 to 255. Can be used directly with the inputBox through blueLED(getSensorBlue());

rawSensorBlue() returns the raw value of the blue component of light, without adjusting for overall illumination. rawSensorBlue() will return different values as the ambient light rises and falls, with getSensorBlue() will remain relatively constant.

int getSensorClear();

Returns to total ambient illumination. Good for adjusting raw values or determining if the light is adequate to determine color.

char getSensorColor();

Returns a character corresponding to the color the sensor detects. Options are: R(ed) O(range) Y(ellow) G(reen) B(lue) P(urple)

void setColorSensorGain(gain);

Set the color sensor gain to adjust for ambient brightness (higher for darker conditions). The default setting works in most situations. must be a value of 1, 4, 16, 60.

void setColorSensorIntegration(integration);

Set the color sensor integration time in milliseconds. Higher values improve the accuracy of the measurement. The default value is suitable for most situations. Must be a value between 3 and 614.

Jump to mimicArm

Jump to inputBox

Jump to voiceControl

Jump to colorSensor

Jump to gridEye IR Sensor

Jump to Sensors


gridEye IR Sensor

robotInputs.h is the mimicEducationalRobots Arduino library (for use with Arduino Uno R3 or compatible), specially designed to simplify interacting with your various sensors.  The library can be downloaded here, and each available command is summarized below. Note the gridEye sensor uses an 8 row x 8 column sensor.

Installation and Use

Copy robotInputs.h and robotInputs.cpp into your "libraries" folder in your Arduino sketchbok, then put:

#include <robotInputs.h>

in your sketch header to use these commands.

Functions are shown in ORANGE, inputs in italics, and constants in BLUE. A “/” indicates limited options are accepted, a “,” indicates more than one input is used and should be included in the code. All inputs are case sensitive.

gridEyeActivate();

gridEyeColMax();

gridEyeRowMax();

gridEyeColMin();

gridEyeRowMin();

gridEyeMaxTemp();

gridEyeMinTemp();

gridEyeTempPoint(row, column);

gridEyeAirTemp();

void gridEyeActivate();

Starts i2C communication on the Arduino. No communication occurs with the gridEye. Most commands will automatically start communication, but including this command is good practice.

int gridEyeColMax();

Returns the column (0-7) containing the highest temperature.

int gridEyeRowMax();

Returns the row (0-7) containing the highest temperature.

int gridEyeColMin();

Returns the column (0-7) containing the lowest temperature.

int gridEyeRowMin();

Returns the row (0-7) containing the lowest temperature.

float gridEyeMaxTemp();

Returns the highest temperature in the gridEye view field, in Celsius

float gridEyeMinTemp();

Returns the lowest temperature in the gridEye view field, in Celsius

float gridEyeTempPoint(int row, int column);

Returns the  temperature in the gridEye at the coordinate specified, in Celsius.

float gridEyeAirTemp();

Returns the  temperature of the gridEye circuit board, in Celsius. Handy for determining roughly the temperature in the room. It becomes difficult to detect body heat at high temperatures.

Jump to mimicArm

Jump to inputBox

Jump to voiceControl

Jump to colorSensor

Jump to gridEye IR Sensor

Jump to Sensors


Sensors

robotInputs.h is the mimicEducationalRobots Arduino library (for use with Arduino Uno R3 or compatible), specially designed to simplify interacting with your various sensors.  The library can be downloaded here, and each available command is summarized below. Note the gridEye sensor uses an 8 row x 8 column sensor.

Installation and Use

Copy robotInputs.h and robotInputs.cpp into your "libraries" folder in your Arduino sketchbok, then put:

#include <robotInputs.h>

in your sketch header to use these commands.

Functions are shown in ORANGE, inputs in italics, and constants in BLUE. A “/” indicates limited options are accepted, a “,” indicates more than one input is used and should be included in the code. All inputs are case sensitive.

motionActivate(inputPin);

motionRead();

motionRead(inputPin);

proxActivate(inputPin);

proxRead();

proxRead(inputPin);

distActivate(inputPin);

distRead();

distRead(inputPin);

void motionActivate(inputPin);

This command sets up the inputPin to the pin connected to the motion sensor. These pin numbers are printed on the mimicArm controller board for easy reference.

int motionRead(); and int motionRead(inputPin);

This function returns 0 if there is no motion and 1 if motion is detected. Specifying inputPin is optional, and is not required if motionActivate(inputPin); has been called. (note, this functions exactly the same as digitalRead(inputPin);)

void proxRead(inputPin);

This command sets up the inputPin to the pin connected to the proximity sensor. These pin numbers are printed on the mimicArm controller board for easy reference.

int proxRead(); and int proxRead(inputPin);

This function returns 0 if there is no motion and 1 if an object is within 10 cm of the sensor. Specifying inputPin is optional, and is not required if proxActivate(inputPin); has been called. (note, this functions exactly the same as digitalRead(inputPin);)

void distRead(inputPin);

This command sets up the inputPin to the pin connected to the proximity sensor. inputPin must be A0 through A3 (A4 and A5 are reserved for I2C). These pin numbers are printed on the mimicArm controller board for easy reference.

int distRead(); and int distRead(inputPin);

This function returns a value from 0 to 32767 representing the distance. Specifying inputPin is optional, and is not required if proxActivate(inputPin); has been called. inputPin must be A0 through A3 (A4 and A5 are reserved for I2C). (note, this functions exactly the same as analogRead(inputPin);)