Reference   Language | Libraries | Comparison | Changes

Robot library

The Robot library is included with Arduino IDE 1.0.5 and later.

The Robot has a number of built in sensors and actuators. The library is designed to easily access the robot's functionality.

The robot has two boards, a motor board and control board. Each board has a separate programmable processor.

The library allows you to interface with the various sensors and peripherals on the control board :

  • potentiometer
  • 5 momentary switches
  • 160x120 pixel color screen
  • 512Kbit EEPROM
  • speaker
  • compass
  • 3 I2C connectors
  • 8 TinkerKit input connectors

The library also enables you to do a number of things with the motor board :

  • control motor speed and direction
  • sense the current used by each motor
  • read the state of the 5 floor sensors (also known as line detection sensors)
  • access I/O pins on the board
  • control an I2C port
  • read the state of 4 TinkerKit inputs

For more information about the Robot, visit the getting started guide and the hardware page.

Library structure

This library enables easy access to the functionality of the Arduino Robot. It relies on a number of 3rd party libraries including Fat16, EasyTransfer, Squawk, and IRRemote. It also relies on a number of Arduino libraries like TFT, SPI, and Wire. Their functionality has been replicated inside the robot's library to optimize the code's size.

It is possible to program both the Control and the Motor boards. However, it is recommended that novice programmers begin with programming the control board, leaving the motor board for later. The library exposes the sensors on both boards through a single object.

There are two main classes that command the robot:

  • RobotControl: commands the Control Board as well as the I/Os and motors on the Motor Board, when running the default firmware.

  • RobotMotor: commands the Motor Board. Use it to make your own custom version of the Motor Board firmware


These illustrate the possibilities of the robot to help you get up and running quickly with the basic functionality.

  • Logo - tell your robot where to go through the on-board keyboard
  • Line Following - draw a racing track and get your robot to run on it
  • Disco Bot - turn your robot into an 8-bit jukebox and dance to the beat
  • Compass - plan a treasure hunt with this digital compass
  • Inputs - learn how to control the knob and the keyboard
  • Wheel Calibration - tune the wheels to perform even better
  • Runaway Robot - play tag with your robot using a distance sensor
  • Remote control - reuse that old tv-remote to command the bot on distance
  • Picture browser - want to use your own images? This is how
  • Rescue - train your robot to look for hidden pearls in a maze
  • Hello User - hack the robot's welcome demo and make your own

RobotControl class

This class commands the Control Board as well as all the I/Os and motors on the Motor Board when it has the stock firmware installed.

RobotMotor class

Use this to make your own firmware for the Motor Board.

Read this document to learn about making your own firmware for the motor board using the RobotMotor class.

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.