Note: This interface is in early beta and is subject to change
You can connect an Arduino to Marty via the expansion port on Marty's control board, RIC. This will provide power and a serial data connection to the Arduino, and you can write Arduino programs to control Marty
Marty's logic level is 3.3v, so if you are using a cable without any level shifting you must only use 3.3v Arduinos. Using a 5V Arduino may damage your Marty's control board
The Arduino connector cable with four wires
Open Marty's face plate by opening the back cover of Marty, removing the top plate, and pushing down on the two small clips at the top of the face
The face plate should be pivoted forward and held in place by the clip at the bottom
Next, attach the Arduino cable to the expansion port at the front of the control board
Close the face plate again and ensure the two clips at the top of the face are clicked back into position
Feed the wires through the slot in the top plate, and reassemble the head
The four wires should be connected as follows
| Wire | Arduino Connection | Note |
|---|---|---|
| Black | GND | |
| Red | VCC | Leave this unconnected while programming the Arduino |
| Blue | RXD | |
| Purple | TXD | |
A really simple Arduino program for Marty looks like this
#include "MartyArduino.h"
Marty marty(Serial);
void setup() {
// put your setup code here, to run once:
marty.init();
}
void loop() {
// put your main code here, to run repeatedly:
marty.dance();
sleep(10);
}
You must include the #include "MartyArduino.hand Marty marty(Serial) lines at the beginning of your program to get access to Marty's functions and instantiate a marty object that will let you talk to Marty. The Serial here specifies which serial port on the Arduino to use - in this case we're using the default one
You must also include the marty.init() line inside your setup function to open the connection to Marty
After that, you can send commands to Marty by calling the appropriate function in the main loop. This example program makes Marty dance repeatedly, waiting 10 seconds in between each dance
Unless you are using a serial port other than the primary one on the Arduino, it is necessary to turn Marty off before programming the Arduino. In this case you will also need to disconnect the 5v power line
A suggested method for programming Marty with the Arduino is this
These are just some starter functions as the library is in a very early stage right now, they will be added to in due course
void dance(uint16_t move_time=3000, bool blocking=true)
Makes Marty dance
Arguments:
void wiggle(uint16_t move_time=4000, bool blocking=true);
A bit like dance, but without the hip movements
Arguments:
void sidestep(String side="left", uint8_t steps=1, uint8_t step_length=35, uint16_t move_time=1000, bool blocking=true);
Take a number of sidesteps to the left or right
Arguments:
void arms(int8_t left_angle=0, int8_t right_angle=0, uint16_t move_time=1000, bool blocking=true);
Move Marty's arms to specified angles
Arguments:
void walk(uint8_t steps=1, int8_t turn=0, int8_t step_length=25, uint16_t move_time=1500, bool blocking=true);
Take a number of steps forwards or backwards, with an optional turn
Arguments: