Examples > Robot?

Disco bot

This sketch demonstrates how to play a melody with the robot, by playing back some sound files.

You can choose between three melodies specially composed for the Arduino Robot using the buttons on the control board. Once you get the music you like, put the robot on the floor and it will dance for you.

Hardware Required

  • Arduino Robot
  • Your best dance outfit


  1. Upload the example, unplug USB and turn on power.
  2. Place the robot on the ground
  3. After the starting screen, the robot will be dancing with music playing and flashing colors on the screen
  4. You can press left/right button to switch music
  5. If you're not satisfied with the dancing moves, change the example to make it dance differently :
    1. Locate the line char danceScript[]="S4L1R1S2F1B1S1\0"
    2. S: stop, L: turn left, R: turn right, F: go forward, B: go backwards
    3. The number after each command decides how long it lasts. 1 = 500ms, 2=1000ms, 3=1500ms, and so forth.

Try it out

Choose a tune


SORRY, There is an error at our code repository, please inform to web@arduino.cc

Explore further

The melodies are stored on the SD card. They are created with a tracker program.

To write your own music, use a tracker program as explained in the Squawk library reference.

See Also: