final project  1
music.c
Go to the documentation of this file.
1 
10 //Darude Sandstorm!
11 
12 #include "main.h"
13 
14 //store song measures
15 unsigned char arr1[6] = {62, 59, 59, 59, 59, 59}; //notes to play
16 unsigned char arr2[6] = {16, 8, 8, 8, 8, 8}; //length of notes
17 
18 unsigned char arr3[6] = {57, 64, 64, 64, 64, 64}; //notes
19 
20 unsigned char arr4[5] = {62, 62, 62, 62, 62}; //notes
21 unsigned char arr5[5] = {8, 8, 8, 8, 8}; //length of notes
22 
23 unsigned char arr6[6] = {57, 59, 59, 59, 59, 59}; //notes
24 
26 
29 void playMusic() {
30  int i = 0;
31 
32 
33  //play Darude Sandstorm
34  oi_loadSong(0, 6, arr1, arr2);
35  oi_loadSong(1, 6, arr3, arr2);
36  oi_loadSong(2, 5, arr4, arr5);
37  oi_loadSong(3, 6, arr6, arr2);
38 
39  for(i=0;i<2;i++) {
40  oi_play_song(0);
41  timer_waitMillis(1750);
42  }
43  oi_play_song(1);
44  timer_waitMillis(1000);
45  oi_play_song(2);
46  timer_waitMillis(1000);
47  oi_play_song(3);
48 
49 
50 
51  //run LED's
52  for(i=0;i<2;i++) { //do this twice
53  oi_setLeds(1, 1, 127, 255); //orange ish
54  timer_waitMillis(500);
55  oi_setLeds(1, 1, 0, 255); //green
56  timer_waitMillis(500);
57  oi_setLeds(1, 1, 255, 255); //red
58  timer_waitMillis(500);
59  oi_setLeds(1, 1, 0, 255); //green
60  timer_waitMillis(500);
61  }
62 }
the main code for the robot to interact with the user
void playMusic()
plays music
Definition: music.c:29