Using the Romi32U4 library, I programmed the Pololu Romi to play and dance to the Hokey Pokey song.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#include <Romi32U4.h>
 
Romi32U4Motors motors;
Romi32U4ButtonA buttonA;
Romi32U4LCD lcd;
PololuBuzzer buzzer;
 
//Music notes transcribed from sheet music found here: https://www.makingmusicfun.net/pdf/sheet_music/hokey_pokey_leadsheet.pdf
const char you_put_your_right_foot_in[] PROGMEM = "MS d8 e8 d8 g4 g4 g8";
const char you_take_your_right_foot_out[] PROGMEM = "MS d8 e8 d8 g4 g4 g8";
const char and_you_shake_it_all_about[] PROGMEM = "MS e8 d8 f#8 e#8 f#8 e8 f#4 R8";
const char you_do_the_hokey_pokey_and[] PROGMEM = "MS d8 f#8 e#8 f#8 e8 f#8 f#8 e8";
const char you_turn_yourself_around[] PROGMEM = "MS d8 f#8 e#8 f#8 e8 f#4 R4";
const char thats_what_its_all_about[] PROGMEM = "MS d8 d4 d8 e4 f#4 g4 R4 R2";
 
void setup() { //Setup code to display battery voltage was taken from 98-012 Square Lab base code
uint16_t batteryLevel;
  while (!buttonA.isPressed()) {
    batteryLevel = readBatteryMillivolts();
 
    lcd.clear();
    lcd.print("B=");
    lcd.print(batteryLevel);
    lcd.print("mV");
    lcd.gotoXY(0, 1);
    lcd.print("Press A");
 
    delay(100);
  }
  lcd.clear();
 
  delay(500);
}
 
void loop() {
  ledYellow(1);
  delay(500);
  ledYellow(0);
  delay(500);
 
  buzzer.playFromProgramSpace(you_put_your_right_foot_in);
  motors.setRightSpeed(100); delay(300);
  motors.setRightSpeed(0);
  while(buzzer.isPlaying()){ }
 
  buzzer.playFromProgramSpace(you_take_your_right_foot_out);
  motors.setRightSpeed(-100); delay(600);
  motors.setRightSpeed(0);
  while(buzzer.isPlaying()){ }
 
  buzzer.playFromProgramSpace(you_put_your_right_foot_in);
  motors.setRightSpeed(100); delay(600);
  motors.setRightSpeed(0);
  while(buzzer.isPlaying()){ }
 
  buzzer.playFromProgramSpace(and_you_shake_it_all_about);
  while(buzzer.isPlaying()){
    motors.setRightSpeed(100); delay(50);
    motors.setRightSpeed(-100); delay(50);
  }
 
  buzzer.playFromProgramSpace(you_do_the_hokey_pokey_and);
  motors.setRightSpeed(-100); delay(200);
  while(buzzer.isPlaying()){
    motors.setRightSpeed(100);
    motors.setLeftSpeed(-100); delay(100);
    motors.setRightSpeed(-100);
    motors.setLeftSpeed(100); delay(100);
  }
 
  buzzer.playFromProgramSpace(you_turn_yourself_around);
  motors.setRightSpeed(100);
  motors.setLeftSpeed(-100); delay(2000);
  motors.setLeftSpeed(0);
  motors.setRightSpeed(0);
  while(buzzer.isPlaying()){ }
 
  buzzer.playFromProgramSpace(thats_what_its_all_about);
  motors.setRightSpeed(0);
  motors.setLeftSpeed(0);
  while(buzzer.isPlaying()){ }
 
  buzzer.playFromProgramSpace(you_put_your_right_foot_in);
  motors.setLeftSpeed(100); delay(300);
  motors.setLeftSpeed(0);
  while(buzzer.isPlaying()){ }
 
  buzzer.playFromProgramSpace(you_take_your_right_foot_out);
  motors.setLeftSpeed(-100); delay(600);
  motors.setLeftSpeed(0);
  while(buzzer.isPlaying()){ }
 
  buzzer.playFromProgramSpace(you_put_your_right_foot_in);
  motors.setLeftSpeed(100); delay(600);
  motors.setLeftSpeed(0);
  while(buzzer.isPlaying()){ }
 
  buzzer.playFromProgramSpace(and_you_shake_it_all_about);
  while(buzzer.isPlaying()){
    motors.setLeftSpeed(100); delay(50);
    motors.setLeftSpeed(-100); delay(50);
  }
 
  buzzer.playFromProgramSpace(you_do_the_hokey_pokey_and);
  motors.setRightSpeed(-100); delay(200);
  while(buzzer.isPlaying()){
    motors.setLeftSpeed(100);
    motors.setRightSpeed(-100); delay(100);
    motors.setLeftSpeed(-100);
    motors.setRightSpeed(100); delay(100);
  }
 
  buzzer.playFromProgramSpace(you_turn_yourself_around);
  motors.setLeftSpeed(100);
  motors.setRightSpeed(-100); delay(2000);
  motors.setLeftSpeed(0);
  motors.setRightSpeed(0);
  while(buzzer.isPlaying()){ }
 
  buzzer.playFromProgramSpace(thats_what_its_all_about);
  motors.setLeftSpeed(0);
  motors.setRightSpeed(0);
  while(buzzer.isPlaying()){ }
}