Project

General

Profile

Revision 2000

Added Priya Deo's and Jeff Cooper's (CS class of 2014) tetris dance code (complete with chip-tune music)!

Priya Deo:
Jeff Cooper:

Written for intro lab 0: Dance competition, Fall 2010

View differences:

trunk/code/behaviors/tetris_dance/lab0.c
1
#include <dragonfly_lib.h>
2
#include <encoders.h>
3
#include <buzzer.h>
4

  
5
/*Colony Lab 0
6
 *Dance Competition
7
 *Robotics Club Colony Project 2010
8
 *
9
 *PUT YOUR NAME HERE
10
 */
11
#define T 100
12
#define SPD 190
13
int main(void)
14
{
15
  {
16
    
17
	/* Initialize dragonfly board */
18
	dragonfly_init(ALL_ON);
19
	
20
	buzzer_init();
21
	bom_init(BOM15);
22
	orb1_set_color(YELLOW);
23
	a6(T/2);
24
	orb2_set_color(YELLOW);
25
	e7(T*3);
26
	delay_ms(T*3);
27
	bom_on();
28
  }
29
	while(1){
30
	  {	//i==1
31
				motor_l_set(FORWARD, SPD);
32
				motor_r_set(BACKWARD, SPD+10);
33
			orb1_set_color(GREEN);
34
		e6(T*2);
35
		b5(T);
36
		c6(T);
37
			orb2_set_color(GREEN);
38
		d6(T*2);
39
			orb2_set_color(CYAN);
40
		c6(T);
41
		
42
				motor_l_set(FORWARD, SPD-10);
43
				motor_r_set(FORWARD, SPD-10);;
44
		b5(T);
45
			orb1_set_color(CYAN);
46
		a5(T*2);
47
		a5(T);
48
		c6(T);
49
			orb1_set_color(ORANGE);
50
			orb2_set_color(ORANGE);
51
		e6(T*2);
52
			orb1_set_color(RED);
53
			orb2_set_color(RED);
54
		d6(T);
55
		c6(T);
56
			orb1_set_color(LIME);
57
			orb2_set_color(LIME);
58
		b5(T*3);
59
		c6(T);
60
		d6(T*2);
61
			orb1_set_color(BLUE);
62
	  }
63

  
64
	{	//i==2
65
				motor_l_set(FORWARD, SPD);
66
				motor_r_set(BACKWARD, SPD);
67
		e6(T*2);
68
			orb2_set_color(BLUE);
69
		c6(T*2);
70
			orb2_set_color(ORB_OFF);
71
		a5(T*2);
72
			orb1_set_color(ORB_OFF);
73
		a5(T);
74
		bom_off();
75
		
76
	{			motors_off();
77
		a5(T*1);
78
		delay_ms(T*2);
79
	}	
80
				motor_l_set(FORWARD, SPD-10);
81
				motor_r_set(FORWARD, SPD-10);
82

  
83
		delay_ms(T);
84
			orb2_set_color(WHITE);
85
		d6(T);
86
		delay_ms(T);
87
			orb1_set_color(WHITE);
88
		f6(T);
89
			orb1_set_color(PINK);
90
			orb2_set_color(PINK);
91
		a6(T);
92
		c6(T/2);
93
		c6(T/2);
94
		g6(T);
95
		f6(T);
96
			orb1_set_color(GREEN);
97
			orb2_set_color(GREEN);
98
		e6(T*2);
99
		delay_ms(T);
100
			orb2_set_color(RED);
101
			orb1_set_color(RED);	
102
		c6(T);
103
		e6(T);
104
		a5(T/2);
105
		g5(T/2);
106

  
107
		d6(T);
108
	}				
109
	{	//i==3
110
				motor_l_set(FORWARD, SPD);
111
				motor_r_set(BACKWARD, SPD);
112
		c6(T);		
113
		b5(T*2);
114

  
115
		delay_ms(T);
116
			orb2_set_color(PURPLE);
117
			orb1_set_color(PURPLE);
118
		c6(T);
119
		d6(T*2);
120
			orb2_set_color(RED);		
121
				motor_r_set(FORWARD, SPD);
122
		e6(T*2);
123
			orb1_set_color(RED);
124
		c6(T*2);
125
			orb1_set_color(ORB_OFF);
126
		a5(T);
127
		a4(T);
128
			orb2_set_color(ORB_OFF);
129
		a5(T);
130
		a4(T);
131
		
132
	{
133
			motors_off();
134
		delay_ms(T*2);
135
			orb2_set_color(ORANGE);
136
			orb1_set_color(ORANGE);
137
		e6(T);
138
	}
139
				motor_l_set(FORWARD, SPD);
140
				motor_r_set(FORWARD, SPD);
141
		e6(T*3);
142
			orb2_set_color(RED);
143
			orb1_set_color(RED);
144
		c6(T*3);	
145
	}	
146
	{	//i==4
147
				motor_l_set(FORWARD, SPD);
148
				motor_r_set(BACKWARD, SPD);
149
		c6(T);
150
			orb2_set_color(MAGENTA);
151
			orb1_set_color(MAGENTA);
152
		d6(T*4);
153
			orb2_set_color(CYAN);
154
			orb1_set_color(CYAN);
155
		b5(T*2);	
156
			
157
				motor_r_set(FORWARD, SPD);
158
		b5(T*2);
159
			orb2_set_color(PURPLE);
160
			orb1_set_color(PURPLE);
161
		c6(T*4);
162
			orb2_set_color(PINK);
163
			orb1_set_color(PINK);
164
		a5(T*4);
165
			orb2_set_color(BLUE);
166
			orb1_set_color(GREEN);
167
		ab5(T*4);
168
			orb1_set_color(BLUE);
169
			orb2_set_color(GREEN);
170
		b5(T);
171
	}	
172
	{	//i==5
173
				motor_l_set(FORWARD, SPD);
174
				motor_r_set(BACKWARD, SPD);
175
		b5(T*2);
176
		delay_ms(T);
177
			orb2_set_color(ORANGE);
178
			orb1_set_color(ORANGE);
179
		e6(T*4);
180
			orb2_set_color(RED);
181
			orb1_set_color(RED);
182
			
183
				motor_r_set(FORWARD, SPD);
184
		c6(T*4);
185
			orb2_set_color(MAGENTA);
186
			orb1_set_color(MAGENTA);
187
		d6(T*4);
188
			orb2_set_color(CYAN);
189
			orb1_set_color(CYAN);
190
		b5(T*4);
191
		c6(T*2);
192
			orb1_set_color(WHITE);
193
		e6(T);
194
	}
195
				motors_off();
196
		
197
	{	//CIRCLE
198

  
199
			motor_l_set(FORWARD, SPD);
200
			motor_r_set(BACKWARD, SPD);
201
		e6(T);
202
			orb2_set_color(WHITE);
203
			
204
		a6(T*4);
205

  
206
	}
207
	{	//RESET
208
			motor_l_set(FORWARD, SPD+50);
209
			motor_r_set(FORWARD, SPD);
210
			
211
			orb1_set_color(LIME);
212
			orb2_set_color(LIME);
213
		ab6(T);
214
			orb1_set_color(ORB_OFF);
215
			orb2_set_color(ORB_OFF);
216
			
217
			delay_ms(T*13);
218
			
219
			motor_l_set(BACKWARD, SPD);
220
			motor_r_set(FORWARD, SPD);
221
			delay_ms(T*3+50);
222
	}
223
	
224
	motors_off();
225
	delay_ms(T*5);
226
	bom_on();
227
	}
228

  
229

  
230
	return 0;
231
}
0 232

  
trunk/code/behaviors/tetris_dance/music.c
1
/*********
2
 * Music Library!
3
 * Now with twice the fiber!
4
 * 
5
 *  Jeff Cooper, Fall 2010
6
 ***************/
7
#ifndef MUSIC_FUNCTIONS
8
#define MUSIC_FUNCTIONS
9
void c0(int dur){buzzer_chirp(dur, 16);} 
10
void db0(int dur){buzzer_chirp(dur, 17);} 
11
void d0(int dur){buzzer_chirp(dur, 18);} 
12
void eb0(int dur){buzzer_chirp(dur, 19);} 
13
void e0(int dur){buzzer_chirp(dur, 20);} 
14
void f0(int dur){buzzer_chirp(dur, 21);} 
15
void gb0(int dur){buzzer_chirp(dur, 23);} 
16
void g0(int dur){buzzer_chirp(dur, 24);} 
17
void ab0(int dur){buzzer_chirp(dur, 25);} 
18
void a0(int dur){buzzer_chirp(dur, 27);} 
19
void bb0(int dur){buzzer_chirp(dur, 29);} 
20
void b0(int dur){buzzer_chirp(dur, 30);} 
21
void c1(int dur){buzzer_chirp(dur, 32);} 
22
void db1(int dur){buzzer_chirp(dur, 34);} 
23
void d1(int dur){buzzer_chirp(dur, 36);} 
24
void eb1(int dur){buzzer_chirp(dur, 38);} 
25
void e1(int dur){buzzer_chirp(dur, 41);} 
26
void f1(int dur){buzzer_chirp(dur, 43);} 
27
void gb1(int dur){buzzer_chirp(dur, 46);} 
28
void g1(int dur){buzzer_chirp(dur, 49);} 
29
void ab1(int dur){buzzer_chirp(dur, 51);} 
30
void a1(int dur){buzzer_chirp(dur, 55);} 
31
void bb1(int dur){buzzer_chirp(dur, 58);} 
32
void b1(int dur){buzzer_chirp(dur, 61);} 
33
void c2(int dur){buzzer_chirp(dur, 65);} 
34
void db2(int dur){buzzer_chirp(dur, 69);} 
35
void d2(int dur){buzzer_chirp(dur, 73);} 
36
void eb2(int dur){buzzer_chirp(dur, 77);} 
37
void e2(int dur){buzzer_chirp(dur, 82);} 
38
void f2(int dur){buzzer_chirp(dur, 87);} 
39
void gb2(int dur){buzzer_chirp(dur, 92);} 
40
void g2(int dur){buzzer_chirp(dur, 98);} 
41
void ab2(int dur){buzzer_chirp(dur, 103);} 
42
void a2(int dur){buzzer_chirp(dur, 110);} 
43
void bb2(int dur){buzzer_chirp(dur, 116);} 
44
void b2(int dur){buzzer_chirp(dur, 123);} 
45
void c3(int dur){buzzer_chirp(dur, 130);} 
46
void db3(int dur){buzzer_chirp(dur, 138);} 
47
void d3(int dur){buzzer_chirp(dur, 146);} 
48
void eb3(int dur){buzzer_chirp(dur, 155);} 
49
void e3(int dur){buzzer_chirp(dur, 164);} 
50
void f3(int dur){buzzer_chirp(dur, 174);} 
51
void gb3(int dur){buzzer_chirp(dur, 185);} 
52
void g3(int dur){buzzer_chirp(dur, 196);} 
53
void ab3(int dur){buzzer_chirp(dur, 207);} 
54
void a3(int dur){buzzer_chirp(dur, 220);} 
55
void bb3(int dur){buzzer_chirp(dur, 233);} 
56
void b3(int dur){buzzer_chirp(dur, 246);} 
57
void c4(int dur){buzzer_chirp(dur, 261);} 
58
void db4(int dur){buzzer_chirp(dur, 277);} 
59
void d4(int dur){buzzer_chirp(dur, 293);} 
60
void eb4(int dur){buzzer_chirp(dur, 311);} 
61
void e4(int dur){buzzer_chirp(dur, 329);} 
62
void f4(int dur){buzzer_chirp(dur, 349);} 
63
void gb4(int dur){buzzer_chirp(dur, 369);} 
64
void g4(int dur){buzzer_chirp(dur, 392);} 
65
void ab4(int dur){buzzer_chirp(dur, 415);} 
66
void a4(int dur){buzzer_chirp(dur, 440);} 
67
void bb4(int dur){buzzer_chirp(dur, 466);} 
68
void b4(int dur){buzzer_chirp(dur, 493);} 
69
void c5(int dur){buzzer_chirp(dur, 523);} 
70
void db5(int dur){buzzer_chirp(dur, 554);} 
71
void d5(int dur){buzzer_chirp(dur, 587);} 
72
void eb5(int dur){buzzer_chirp(dur, 622);} 
73
void e5(int dur){buzzer_chirp(dur, 659);} 
74
void f5(int dur){buzzer_chirp(dur, 698);} 
75
void gb5(int dur){buzzer_chirp(dur, 739);} 
76
void g5(int dur){buzzer_chirp(dur, 783);} 
77
void ab5(int dur){buzzer_chirp(dur, 830);} 
78
void a5(int dur){buzzer_chirp(dur, 880);} 
79
void bb5(int dur){buzzer_chirp(dur, 932);} 
80
void b5(int dur){buzzer_chirp(dur, 987);} 
81
void c6(int dur){buzzer_chirp(dur, 1046);} 
82
void db6(int dur){buzzer_chirp(dur, 1108);} 
83
void d6(int dur){buzzer_chirp(dur, 1174);} 
84
void eb6(int dur){buzzer_chirp(dur, 1244);} 
85
void e6(int dur){buzzer_chirp(dur, 1318);} 
86
void f6(int dur){buzzer_chirp(dur, 1396);} 
87
void gb6(int dur){buzzer_chirp(dur, 1479);} 
88
void g6(int dur){buzzer_chirp(dur, 1567);} 
89
void ab6(int dur){buzzer_chirp(dur, 1661);} 
90
void a6(int dur){buzzer_chirp(dur, 1760);} 
91
void bb6(int dur){buzzer_chirp(dur, 1864);} 
92
void b6(int dur){buzzer_chirp(dur, 1975);} 
93
void c7(int dur){buzzer_chirp(dur, 2093);} 
94
void db7(int dur){buzzer_chirp(dur, 2217);} 
95
void d7(int dur){buzzer_chirp(dur, 2349);} 
96
void eb7(int dur){buzzer_chirp(dur, 2489);} 
97
void e7(int dur){buzzer_chirp(dur, 2637);} 
98
void f7(int dur){buzzer_chirp(dur, 2793);} 
99
void gb7(int dur){buzzer_chirp(dur, 2959);} 
100
void g7(int dur){buzzer_chirp(dur, 3135);} 
101
void ab7(int dur){buzzer_chirp(dur, 3322);} 
102
void a7(int dur){buzzer_chirp(dur, 3520);} 
103
void bb7(int dur){buzzer_chirp(dur, 3729);} 
104
void b7(int dur){buzzer_chirp(dur, 3951);} 
105
void c8(int dur){buzzer_chirp(dur, 4186);} 
106
void db8(int dur){buzzer_chirp(dur, 4434);} 
107
void d8(int dur){buzzer_chirp(dur, 4698);} 
108
void eb8(int dur){buzzer_chirp(dur, 4978);} 
109
#endif
0 110

  
trunk/code/behaviors/tetris_dance/slavecode/lab0.c
1
#include <dragonfly_lib.h>
2
#include <encoders.h>
3
#include <buzzer.h>
4
#include <math.h>
5
#include <serial.h>
6
/*Colony Lab 0
7
 *Dance Competition
8
 *Robotics Club Colony Project 2010
9
 *
10
 * Jeff Cooper
11
 *    and
12
 * Priya Deo
13
 */
14
#define T 100
15
int main(void)
16
{
17
	/************
18
	 *
19
	 * HIVECODE
20
	 *
21
	 ***********/
22
	char k;
23

  
24
	/* Initialize dragonfly board */
25
	dragonfly_init(ALL_ON);
26

  
27
	buzzer_init();
28
	bom_init(BOM15);
29
	/* ****** YOUR CODE BEGINS HERE ******* */
30
	
31
		orb1_set_color(YELLOW);
32
	a6(T/2);
33
		orb2_set_color(YELLOW);
34
	e7(T*3);
35
	delay_ms(T*3);
36
	bom_refresh(BOM_ALL);
37
	while(bom_get_max() == -1 && !button1_read() ){bom_refresh(BOM_ALL);}
38
	while(1)
39
	{
40
	{
41
		bom_on();
42
			orb1_set_color(GREEN);
43
		e6(T*2);
44
		b5(T);
45
		c6(T);
46
			orb2_set_color(GREEN);
47
		d6(T*2);
48
			orb2_set_color(CYAN);
49
		c6(T);
50
		
51

  
52

  
53
		b5(T);
54
			orb1_set_color(CYAN);
55
		a5(T*2);
56
		a5(T);
57
		c6(T);
58
			orb1_set_color(ORANGE);
59
			orb2_set_color(ORANGE);
60
		e6(T*2);
61
			orb1_set_color(RED);
62
			orb2_set_color(RED);
63
		d6(T);
64
		c6(T);
65
			orb1_set_color(LIME);
66
			orb2_set_color(LIME);
67
		b5(T*3);
68
		c6(T);
69
		d6(T*2);
70
			orb1_set_color(BLUE);
71
		bom_off();
72
	  }
73

  
74
	{	//i==2
75

  
76

  
77
		e6(T*2);
78
			orb2_set_color(BLUE);
79
		c6(T*2);
80
			orb2_set_color(ORB_OFF);
81
		a5(T*2);
82
			orb1_set_color(ORB_OFF);
83
		a5(T);
84
		
85

  
86
		a5(T*1);
87
		delay_ms(T*2);
88
	}	
89
	{
90

  
91

  
92
		delay_ms(T);
93
			orb2_set_color(WHITE);
94
		d6(T);
95
		delay_ms(T);
96
			orb1_set_color(WHITE);
97
		f6(T);
98
			orb1_set_color(PINK);
99
			orb2_set_color(PINK);
100
		a6(T);
101
		c6(T/2);
102
		c6(T/2);
103
		g6(T);
104
		f6(T);
105
			orb1_set_color(GREEN);
106
			orb2_set_color(GREEN);
107
		e6(T*2);
108
		delay_ms(T);
109
			orb2_set_color(RED);
110
			orb1_set_color(RED);	
111
		c6(T);
112
		e6(T);
113
		a5(T/2);
114
		g5(T/2);
115

  
116
		d6(T);
117
	}				
118
	{	//i==3
119

  
120

  
121
		c6(T);		
122
		b5(T*2);
123

  
124
		delay_ms(T);
125
			orb2_set_color(PURPLE);
126
			orb1_set_color(PURPLE);
127
		c6(T);
128

  
129
		d6(T*2);
130
			orb2_set_color(RED);		
131

  
132
		e6(T*2);
133
			orb1_set_color(RED);
134
		c6(T*2);
135
			orb1_set_color(ORB_OFF);
136
		a5(T);
137
		a4(T);
138
			orb2_set_color(ORB_OFF);
139
		a5(T);
140
		a4(T);
141
		
142
	{
143

  
144
		delay_ms(T*2);
145
			orb2_set_color(ORANGE);
146
			orb1_set_color(ORANGE);
147
		e6(T);
148
	}
149

  
150

  
151
		e6(T*3);
152
			orb2_set_color(RED);
153
			orb1_set_color(RED);
154
		c6(T*3);	
155
	}	
156
	{	//i==4
157

  
158

  
159
		c6(T);
160
			orb2_set_color(MAGENTA);
161
			orb1_set_color(MAGENTA);
162
		d6(T*4);
163
			orb2_set_color(CYAN);
164
			orb1_set_color(CYAN);
165
		b5(T*2);	
166
			
167

  
168
		b5(T*2);
169
			orb2_set_color(PURPLE);
170
			orb1_set_color(PURPLE);
171
		c6(T*4);
172
			orb2_set_color(PINK);
173
			orb1_set_color(PINK);
174
		a5(T*4);
175
			orb2_set_color(BLUE);
176
			orb1_set_color(GREEN);
177
		ab5(T*4);
178
			orb1_set_color(BLUE);
179
			orb2_set_color(GREEN);
180
		b5(T);
181
	}	
182
	{	//i==5
183

  
184

  
185
		b5(T*2);
186
		delay_ms(T);
187
			orb2_set_color(ORANGE);
188
			orb1_set_color(ORANGE);
189
		e6(T*4);
190
			orb2_set_color(RED);
191
			orb1_set_color(RED);
192
			
193

  
194
		c6(T*4);
195
			orb2_set_color(MAGENTA);
196
			orb1_set_color(MAGENTA);
197
		d6(T*4);
198
			orb2_set_color(CYAN);
199
			orb1_set_color(CYAN);
200
		b5(T*4);
201
		c6(T*2);
202
			orb1_set_color(WHITE);
203
		e6(T);
204
	}
205

  
206
		
207
	{	//CIRCLE
208

  
209

  
210

  
211
		e6(T);
212
			orb2_set_color(WHITE);
213
			
214
		a6(T*4);
215

  
216
	}
217
	{	//RESET
218

  
219

  
220
			
221
			orb1_set_color(LIME);
222
			orb2_set_color(LIME);
223
		ab6(T);
224
			orb1_set_color(ORB_OFF);
225
			orb2_set_color(ORB_OFF);
226
			
227
			delay_ms(T*13);
228
			
229

  
230

  
231
			delay_ms(T*3);
232
	}
233
	
234

  
235
	bom_refresh(BOM_ALL);
236
	while(bom_get_max() == -1){bom_refresh(BOM_ALL);}
237

  
238
	
239
	}	
240

  
241
	/* ****** YOUR CODE ENDS HERE ******* */
242

  
243

  
244
	return 0;
245
}
trunk/code/behaviors/tetris_dance/slavecode/music.c
1
/*********
2
 * Music Library!
3
 * Now with twice the fiber!
4
 * 
5
 *  Jeff Cooper, Fall 2010
6
 ***************/
7
#ifndef MUSIC_FUNCTIONS
8
#define MUSIC_FUNCTIONS
9
void c0(int dur){buzzer_chirp(dur, 16);} 
10
void db0(int dur){buzzer_chirp(dur, 17);} 
11
void d0(int dur){buzzer_chirp(dur, 18);} 
12
void eb0(int dur){buzzer_chirp(dur, 19);} 
13
void e0(int dur){buzzer_chirp(dur, 20);} 
14
void f0(int dur){buzzer_chirp(dur, 21);} 
15
void gb0(int dur){buzzer_chirp(dur, 23);} 
16
void g0(int dur){buzzer_chirp(dur, 24);} 
17
void ab0(int dur){buzzer_chirp(dur, 25);} 
18
void a0(int dur){buzzer_chirp(dur, 27);} 
19
void bb0(int dur){buzzer_chirp(dur, 29);} 
20
void b0(int dur){buzzer_chirp(dur, 30);} 
21
void c1(int dur){buzzer_chirp(dur, 32);} 
22
void db1(int dur){buzzer_chirp(dur, 34);} 
23
void d1(int dur){buzzer_chirp(dur, 36);} 
24
void eb1(int dur){buzzer_chirp(dur, 38);} 
25
void e1(int dur){buzzer_chirp(dur, 41);} 
26
void f1(int dur){buzzer_chirp(dur, 43);} 
27
void gb1(int dur){buzzer_chirp(dur, 46);} 
28
void g1(int dur){buzzer_chirp(dur, 49);} 
29
void ab1(int dur){buzzer_chirp(dur, 51);} 
30
void a1(int dur){buzzer_chirp(dur, 55);} 
31
void bb1(int dur){buzzer_chirp(dur, 58);} 
32
void b1(int dur){buzzer_chirp(dur, 61);} 
33
void c2(int dur){buzzer_chirp(dur, 65);} 
34
void db2(int dur){buzzer_chirp(dur, 69);} 
35
void d2(int dur){buzzer_chirp(dur, 73);} 
36
void eb2(int dur){buzzer_chirp(dur, 77);} 
37
void e2(int dur){buzzer_chirp(dur, 82);} 
38
void f2(int dur){buzzer_chirp(dur, 87);} 
39
void gb2(int dur){buzzer_chirp(dur, 92);} 
40
void g2(int dur){buzzer_chirp(dur, 98);} 
41
void ab2(int dur){buzzer_chirp(dur, 103);} 
42
void a2(int dur){buzzer_chirp(dur, 110);} 
43
void bb2(int dur){buzzer_chirp(dur, 116);} 
44
void b2(int dur){buzzer_chirp(dur, 123);} 
45
void c3(int dur){buzzer_chirp(dur, 130);} 
46
void db3(int dur){buzzer_chirp(dur, 138);} 
47
void d3(int dur){buzzer_chirp(dur, 146);} 
48
void eb3(int dur){buzzer_chirp(dur, 155);} 
49
void e3(int dur){buzzer_chirp(dur, 164);} 
50
void f3(int dur){buzzer_chirp(dur, 174);} 
51
void gb3(int dur){buzzer_chirp(dur, 185);} 
52
void g3(int dur){buzzer_chirp(dur, 196);} 
53
void ab3(int dur){buzzer_chirp(dur, 207);} 
54
void a3(int dur){buzzer_chirp(dur, 220);} 
55
void bb3(int dur){buzzer_chirp(dur, 233);} 
56
void b3(int dur){buzzer_chirp(dur, 246);} 
57
void c4(int dur){buzzer_chirp(dur, 261);} 
58
void db4(int dur){buzzer_chirp(dur, 277);} 
59
void d4(int dur){buzzer_chirp(dur, 293);} 
60
void eb4(int dur){buzzer_chirp(dur, 311);} 
61
void e4(int dur){buzzer_chirp(dur, 329);} 
62
void f4(int dur){buzzer_chirp(dur, 349);} 
63
void gb4(int dur){buzzer_chirp(dur, 369);} 
64
void g4(int dur){buzzer_chirp(dur, 392);} 
65
void ab4(int dur){buzzer_chirp(dur, 415);} 
66
void a4(int dur){buzzer_chirp(dur, 440);} 
67
void bb4(int dur){buzzer_chirp(dur, 466);} 
68
void b4(int dur){buzzer_chirp(dur, 493);} 
69
void c5(int dur){buzzer_chirp(dur, 523);} 
70
void db5(int dur){buzzer_chirp(dur, 554);} 
71
void d5(int dur){buzzer_chirp(dur, 587);} 
72
void eb5(int dur){buzzer_chirp(dur, 622);} 
73
void e5(int dur){buzzer_chirp(dur, 659);} 
74
void f5(int dur){buzzer_chirp(dur, 698);} 
75
void gb5(int dur){buzzer_chirp(dur, 739);} 
76
void g5(int dur){buzzer_chirp(dur, 783);} 
77
void ab5(int dur){buzzer_chirp(dur, 830);} 
78
void a5(int dur){buzzer_chirp(dur, 880);} 
79
void bb5(int dur){buzzer_chirp(dur, 932);} 
80
void b5(int dur){buzzer_chirp(dur, 987);} 
81
void c6(int dur){buzzer_chirp(dur, 1046);} 
82
void db6(int dur){buzzer_chirp(dur, 1108);} 
83
void d6(int dur){buzzer_chirp(dur, 1174);} 
84
void eb6(int dur){buzzer_chirp(dur, 1244);} 
85
void e6(int dur){buzzer_chirp(dur, 1318);} 
86
void f6(int dur){buzzer_chirp(dur, 1396);} 
87
void gb6(int dur){buzzer_chirp(dur, 1479);} 
88
void g6(int dur){buzzer_chirp(dur, 1567);} 
89
void ab6(int dur){buzzer_chirp(dur, 1661);} 
90
void a6(int dur){buzzer_chirp(dur, 1760);} 
91
void bb6(int dur){buzzer_chirp(dur, 1864);} 
92
void b6(int dur){buzzer_chirp(dur, 1975);} 
93
void c7(int dur){buzzer_chirp(dur, 2093);} 
94
void db7(int dur){buzzer_chirp(dur, 2217);} 
95
void d7(int dur){buzzer_chirp(dur, 2349);} 
96
void eb7(int dur){buzzer_chirp(dur, 2489);} 
97
void e7(int dur){buzzer_chirp(dur, 2637);} 
98
void f7(int dur){buzzer_chirp(dur, 2793);} 
99
void gb7(int dur){buzzer_chirp(dur, 2959);} 
100
void g7(int dur){buzzer_chirp(dur, 3135);} 
101
void ab7(int dur){buzzer_chirp(dur, 3322);} 
102
void a7(int dur){buzzer_chirp(dur, 3520);} 
103
void bb7(int dur){buzzer_chirp(dur, 3729);} 
104
void b7(int dur){buzzer_chirp(dur, 3951);} 
105
void c8(int dur){buzzer_chirp(dur, 4186);} 
106
void db8(int dur){buzzer_chirp(dur, 4434);} 
107
void d8(int dur){buzzer_chirp(dur, 4698);} 
108
void eb8(int dur){buzzer_chirp(dur, 4978);} 
109
#endif
trunk/code/behaviors/tetris_dance/slavecode/Makefile
1
########Update This Section########
2
#
3
#
4

  
5
# Relative path to the root directory (containing lib directory)
6
ifndef COLONYROOT
7
COLONYROOT = .
8
endif
9

  
10
# Target file name (without extension).
11
TARGET = lab0
12

  
13
# Uncomment this to use the wireless library
14
#USE_WIRELESS = 1
15

  
16
# com1 = serial port. Use lpt1 to connect to parallel port.
17
AVRDUDE_PORT = /dev/ttyUSB0
18
#$(shell if uname -s |grep -i w32 >/dev/null; then echo 'COM4:'; else echo '/dev/ttyUSB0'; fi)
19

  
20
#
21
###################################
22

  
23
# Hey Emacs, this is a -*- makefile -*-
24
#----------------------------------------------------------------------------
25
# WinAVR Makefile Template written by Eric B. Weddington, J?rg Wunsch, et al.
26
#
27
# Released to the Public Domain
28
#
29
# Additional material for this makefile was written by:
30
# Peter Fleury
31
# Tim Henigan
32
# Colin O'Flynn
33
# Reiner Patommel
34
# Markus Pfaff
35
# Sander Pool
36
# Frederik Rouleau
37
#
38
#----------------------------------------------------------------------------
39
# On command line:
40
#
41
# make all = Make software.
42
#
43
# make clean = Clean out built project files.
44
#
45
# make coff = Convert ELF to AVR COFF.
46
#
47
# make extcoff = Convert ELF to AVR Extended COFF.
48
#
49
# make program = Download the hex file to the device, using avrdude.
50
#                Please customize the avrdude settings below first!
51
#
52
# make debug = Start either simulavr or avarice as specified for debugging,
53
#              with avr-gdb or avr-insight as the front end for debugging.
54
#
55
# make filename.s = Just compile filename.c into the assembler code only.
56
#
57
# make filename.i = Create a preprocessed source file for use in submitting
58
#                   bug reports to the GCC project.
59
#
60
# To rebuild project do "make clean" then "make all".
61
#----------------------------------------------------------------------------
62

  
63
#if you want your code to work on the Firefly++ and not Firefly+
64
#then add the -DFFPP line to CDEFS
65
CDEFS =
66
#-DFFPP
67

  
68
# MCU name
69
MCU = atmega128
70

  
71
# Processor frequency.
72
#     This will define a symbol, F_CPU, in all source code files equal to the
73
#     processor frequency. You can then use this symbol in your source code to
74
#     calculate timings. Do NOT tack on a 'UL' at the end, this will be done
75
#     automatically to create a 32-bit value in your source code.
76
F_CPU = 8000000
77

  
78
# Output format. (can be srec, ihex, binary)
79
FORMAT = ihex
80

  
81
# List C source files here. (C dependencies are automatically generated.)
82
SRC = $(wildcard *.c)
83

  
84
# List Assembler source files here.
85
#     Make them always end in a capital .S.  Files ending in a lowercase .s
86
#     will not be considered source files but generated files (assembler
87
#     output from the compiler), and will be deleted upon "make clean"!
88
#     Even though the DOS/Win* filesystem matches both .s and .S the same,
89
#     it will preserve the spelling of the filenames, and gcc itself does
90
#     care about how the name is spelled on its command-line.
91
ASRC =
92

  
93
# Optimization level, can be [0, 1, 2, 3, s].
94
#     0 = turn off optimization. s = optimize for size.
95
#     (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
96
OPT = s
97

  
98
# Debugging format.
99
#     Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
100
#     AVR Studio 4.10 requires dwarf-2.
101
#     AVR [Extended] COFF format requires stabs, plus an avr-objcopy run.
102
DEBUG =
103

  
104
# Compiler flag to set the C Standard level.
105
#     c89   = "ANSI" C
106
#     gnu89 = c89 plus GCC extensions
107
#     c99   = ISO C99 standard (not yet fully implemented)
108
#     gnu99 = c99 plus GCC extensions
109
CSTANDARD = -std=gnu99
110

  
111
# Place -D or -U options here
112
CDEFS += -DF_CPU=$(F_CPU)UL
113
CDEFS += -DFFP
114
# for wireless library
115
ifdef USE_WIRELESS
116
	CDEFS += -DROBOT
117
endif
118

  
119
# Place -I, -L options here
120
CINCS = -I$(COLONYROOT)/Library
121
CINCS += -L$(COLONYROOT)/Library
122
ifdef USE_WIRELESS
123
	CINCS += -I$(COLONYROOT)/code/lib/include/libwireless
124
endif
125

  
126
#---------------- Compiler Options ----------------
127
#  -g*:          generate debugging information
128
#  -O*:          optimization level
129
#  -f...:        tuning, see GCC manual and avr-libc documentation
130
#  -Wall...:     warning level
131
#  -Wa,...:      tell GCC to pass this to the assembler.
132
#    -adhlns...: create assembler listing
133
CFLAGS =
134
# CFLAGS = -g$(DEBUG)
135
CFLAGS += $(CDEFS) $(CINCS)
136
CFLAGS += -O$(OPT)
137
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
138
CFLAGS += -Wall -Wstrict-prototypes
139
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
140
CFLAGS += $(CSTANDARD)
141

  
142
#---------------- Assembler Options ----------------
143
#  -Wa,...:   tell GCC to pass this to the assembler.
144
#  -ahlms:    create listing
145
#  -gstabs:   have the assembler create line number information; note that
146
#             for use in COFF files, additional information about filenames
147
#             and function names needs to be present in the assembler source
148
#             files -- see avr-libc docs [FIXME: not yet described there]
149
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
150

  
151

  
152
#---------------- Library Options ----------------
153
# Minimalistic printf version
154
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
155

  
156
# Floating point printf version (requires MATH_LIB = -lm below)
157
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
158

  
159
# If this is left blank, then it will use the Standard printf version.
160
#PRINTF_LIB =
161
#PRINTF_LIB = $(PRINTF_LIB_MIN)
162
PRINTF_LIB = $(PRINTF_LIB_FLOAT)
163

  
164

  
165
# Minimalistic scanf version
166
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
167

  
168
# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
169
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
170

  
171
# If this is left blank, then it will use the Standard scanf version.
172
SCANF_LIB =
173
#SCANF_LIB = $(SCANF_LIB_MIN)
174
#SCANF_LIB = $(SCANF_LIB_FLOAT)
175

  
176
MATH_LIB = -lm
177

  
178
#---------------- External Memory Options ----------------
179

  
180
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
181
# used for variables (.data/.bss) and heap (malloc()).
182
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff
183

  
184
# 64 KB of external RAM, starting after internal RAM (ATmega128!),
185
# only used for heap (malloc()).
186
#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
187

  
188
EXTMEMOPTS =
189

  
190
#---------------- Linker Options ----------------
191
#  -Wl,...:     tell GCC to pass this to linker.
192
#    -Map:      create map file
193
#    --cref:    add cross reference to  map file
194
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
195
LDFLAGS += $(EXTMEMOPTS)
196
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
197
ifdef USE_WIRELESS
198
	LDFLAGS += -lwireless
199
endif
200
LDFLAGS += -ldragonfly
201

  
202

  
203

  
204
#---------------- Programming Options (avrdude) ----------------
205

  
206
# Programming hardware: alf avr910 avrisp bascom bsd
207
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
208
#
209
# Type: avrdude -c ?
210
# to get a full listing.
211
#
212
AVRDUDE_PROGRAMMER = avrisp
213

  
214
# programmer connected to serial device
215

  
216
AVRDUDE_WRITE_FLASH = -b 57600 -U flash:w:$(TARGET).hex
217
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
218

  
219

  
220
# Uncomment the following if you want avrdude's erase cycle counter.
221
# Note that this counter needs to be initialized first using -Yn,
222
# see avrdude manual.
223
#AVRDUDE_ERASE_COUNTER = -y
224

  
225
# Uncomment the following if you do /not/ wish a verification to be
226
# performed after programming the device.
227
#AVRDUDE_NO_VERIFY = -V
228

  
229
# Increase verbosity level.  Please use this when submitting bug
230
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
231
# to submit bug reports.
232
#AVRDUDE_VERBOSE = -v -v
233

  
234
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
235
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY)
236
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE)
237
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER)
238

  
239
#don't check for device signature
240
AVRDUDE_FLAGS += -F
241

  
242

  
243

  
244
#---------------- Debugging Options ----------------
245

  
246
# For simulavr only - target MCU frequency.
247
DEBUG_MFREQ = $(F_CPU)
248

  
249
# Set the DEBUG_UI to either gdb or insight.
250
# DEBUG_UI = gdb
251
DEBUG_UI = insight
252

  
253
# Set the debugging back-end to either avarice, simulavr.
254
DEBUG_BACKEND = avarice
255
#DEBUG_BACKEND = simulavr
256

  
257
# GDB Init Filename.
258
GDBINIT_FILE = __avr_gdbinit
259

  
260
# When using avarice settings for the JTAG
261
JTAG_DEV = /dev/com1
262

  
263
# Debugging port used to communicate between GDB / avarice / simulavr.
264
DEBUG_PORT = 4242
265

  
266
# Debugging host used to communicate between GDB / avarice / simulavr, normally
267
#     just set to localhost unless doing some sort of crazy debugging when
268
#     avarice is running on a different computer.
269
DEBUG_HOST = localhost
270

  
271

  
272

  
273
#============================================================================
274

  
275

  
276
# Define programs and commands.
277
SHELL = sh
278
CC = avr-gcc
279
OBJCOPY = avr-objcopy
280
OBJDUMP = avr-objdump
281
SIZE = avr-size
282
NM = avr-nm
283
AVRDUDE = avrdude
284
REMOVE = rm -f
285
REMOVEDIR = rm -rf
286
COPY = cp
287
WINSHELL = cmd
288

  
289

  
290
# Define Messages
291
# English
292
MSG_ERRORS_NONE = Errors: none
293
MSG_BEGIN = -------- begin --------
294
MSG_END = --------  end  --------
295
MSG_SIZE_BEFORE = Size before:
296
MSG_SIZE_AFTER = Size after:
297
MSG_COFF = Converting to AVR COFF:
298
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
299
MSG_FLASH = Creating load file for Flash:
300
MSG_EEPROM = Creating load file for EEPROM:
301
MSG_EXTENDED_LISTING = Creating Extended Listing:
302
MSG_SYMBOL_TABLE = Creating Symbol Table:
303
MSG_LINKING = Linking:
304
MSG_COMPILING = Compiling:
305
MSG_ASSEMBLING = Assembling:
306
MSG_CLEANING = Cleaning project:
307

  
308

  
309

  
310

  
311
# Define all object files.
312
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
313

  
314
# Define all listing files.
315
LST = $(SRC:.c=.lst) $(ASRC:.S=.lst)
316

  
317

  
318
# Compiler flags to generate dependency files.
319
GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d
320

  
321

  
322
# Combine all necessary flags and optional flags.
323
# Add target processor to flags.
324
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS)
325
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
326

  
327

  
328

  
329

  
330

  
331
# Default target.
332
all: begin gccversion sizebefore build sizeafter end
333

  
334
build: elf hex eep lss sym
335

  
336
elf: $(TARGET).elf
337
hex: $(TARGET).hex
338
eep: $(TARGET).eep
339
lss: $(TARGET).lss
340
sym: $(TARGET).sym
341

  
342

  
343

  
344
# Eye candy.
345
# AVR Studio 3.x does not check make's exit code but relies on
346
# the following magic strings to be generated by the compile job.
347
begin:
348
	@echo
349
	@echo $(MSG_BEGIN)
350

  
351
end:
352
	@echo $(MSG_END)
353
	@echo
354

  
355

  
356
# Display size of file.
357
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
358
ELFSIZE = $(SIZE) -A $(TARGET).elf
359
AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)
360

  
361
sizebefore:
362
	@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
363
	$(AVRMEM) 2>/dev/null; echo; fi
364

  
365
sizeafter:
366
	@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
367
	$(AVRMEM) 2>/dev/null; echo; fi
368

  
369

  
370

  
371
# Display compiler version information.
372
gccversion :
373
	@$(CC) --version
374

  
375

  
376

  
377
# Program the device.
378
program: $(TARGET).hex $(TARGET).eep
379
	$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
380

  
381

  
382
# Generate avr-gdb config/init file which does the following:
383
#     define the reset signal, load the target file, connect to target, and set
384
#     a breakpoint at main().
385
gdb-config:
386
	@$(REMOVE) $(GDBINIT_FILE)
387
	@echo define reset >> $(GDBINIT_FILE)
388
	@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
389
	@echo end >> $(GDBINIT_FILE)
390
	@echo file $(TARGET).elf >> $(GDBINIT_FILE)
391
	@echo target remote $(DEBUG_HOST):$(DEBUG_PORT)  >> $(GDBINIT_FILE)
392
ifeq ($(DEBUG_BACKEND),simulavr)
393
	@echo load  >> $(GDBINIT_FILE)
394
endif
395
	@echo break main >> $(GDBINIT_FILE)
396

  
397
debug: gdb-config $(TARGET).elf
398
ifeq ($(DEBUG_BACKEND), avarice)
399
	@echo Starting AVaRICE - Press enter when "waiting to connect" message displays.
400
	@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \
401
	$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT)
402
	@$(WINSHELL) /c pause
403

  
404
else
405
	@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \
406
	$(DEBUG_MFREQ) --port $(DEBUG_PORT)
407
endif
408
	@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE)
409

  
410

  
411

  
412

  
413
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
414
COFFCONVERT=$(OBJCOPY) --debugging \
415
--change-section-address .data-0x800000 \
416
--change-section-address .bss-0x800000 \
417
--change-section-address .noinit-0x800000 \
418
--change-section-address .eeprom-0x810000
419

  
420

  
421
coff: $(TARGET).elf
422
	@echo
423
	@echo $(MSG_COFF) $(TARGET).cof
424
	$(COFFCONVERT) -O coff-avr $< $(TARGET).cof
425

  
426

  
427
extcoff: $(TARGET).elf
428
	@echo
429
	@echo $(MSG_EXTENDED_COFF) $(TARGET).cof
430
	$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof
431

  
432

  
433

  
434
# Create final output files (.hex, .eep) from ELF output file.
435
%.hex: %.elf
436
	@echo
437
	@echo $(MSG_FLASH) $@
438
	$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
439

  
440
%.eep: %.elf
441
	@echo
442
	@echo $(MSG_EEPROM) $@
443
	-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
444
	--change-section-lma .eeprom=0 -O $(FORMAT) $< $@
445

  
446
# Create extended listing file from ELF output file.
447
%.lss: %.elf
448
	@echo
449
	@echo $(MSG_EXTENDED_LISTING) $@
450
	$(OBJDUMP) -h -S $< > $@
451

  
452
# Create a symbol table from ELF output file.
453
%.sym: %.elf
454
	@echo
455
	@echo $(MSG_SYMBOL_TABLE) $@
456
	$(NM) -n $< > $@
457

  
458

  
459

  
460
# Link: create ELF output file from object files.
461
.SECONDARY : $(TARGET).elf
462
.PRECIOUS : $(OBJ)
463
%.elf: $(OBJ)
464
	@echo
465
	@echo $(MSG_LINKING) $@
466
	$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS)
467

  
468

  
469
# Compile: create object files from C source files.
470
%.o : %.c
471
	@echo
472
	@echo $(MSG_COMPILING) $<
473
	$(CC) -c $(ALL_CFLAGS) $< -o $@
474

  
475

  
476
# Compile: create assembler files from C source files.
477
%.s : %.c
478
	$(CC) -S $(ALL_CFLAGS) $< -o $@
479

  
480

  
481
# Assemble: create object files from assembler source files.
482
%.o : %.S
483
	@echo
484
	@echo $(MSG_ASSEMBLING) $<
485
	$(CC) -c $(ALL_ASFLAGS) $< -o $@
486

  
487
# Create preprocessed source for use in sending a bug report.
488
%.i : %.c
489
	$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
490

  
491

  
492
# Target: clean project.
493
clean: begin clean_list end
494

  
495
clean_list :
496
	@echo
497
	@echo $(MSG_CLEANING)
498
	$(REMOVE) $(TARGET).hex
499
	$(REMOVE) $(TARGET).eep
500
	$(REMOVE) $(TARGET).cof
501
	$(REMOVE) $(TARGET).elf
502
	$(REMOVE) $(TARGET).map
503
	$(REMOVE) $(TARGET).sym
504
	$(REMOVE) $(TARGET).lss
505
	$(REMOVE) $(OBJ)
506
	$(REMOVE) $(LST)
507
	$(REMOVE) $(SRC:.c=.s)
508
	$(REMOVE) $(SRC:.c=.d)
509
	$(REMOVEDIR) .dep
510

  
511

  
512

  
513
# Include the dependency files.
514
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)
515

  
516

  
517
# Listing of phony targets.
518
.PHONY : all begin finish end sizebefore sizeafter gccversion \
519
build elf hex eep lss sym coff extcoff \
520
clean clean_list program debug gdb-config
521

  
trunk/code/behaviors/tetris_dance/README
1
 _____ _____ _____ ____  ___ ____  
2
|_   _| ____|_   _|  _ \|_ _/ ___| 
3
  | | |  _|   | | | |_) || |\___ \ 
4
  | | | |___  | | |  _ < | | ___) |
5
  |_| |_____| |_| |_| \_\___|____/ 
6
                                   
7
	An overly-silly lab0 by
8
	Jeff Cooper and Priya Deo,
9
		Fall 2010
10
======================================
11

  
12
You're reading the README, good for you!
13

  
14
Here's how this code breaks down:
15

  
16
mastercode/:
17
	lab0.c
18
	music.c
19
	Makefile
20

  
21
slavecode/:
22
	lab0.c
23
	music.c
24
	Makefile
25

  
26
music.c
27

  
28
You'll notice that music.c exists three times. 
29
It's the same file, don't worry.
30

  
31
Mastercode is the stand-alone version of the tetris dance,
32
and also the only one that dances.  It turns the BOM on and off
33
at various points during the song to synchronize with the bots
34
running slavecode.
35

  
36
Slavecode contains the song and lights but no dance.  It won't
37
play the song (or repeat it, when it ends) without a signal from a BOM,
38
and it turns on it's own BOM when it gets that signal so you can chain
39
them across a room (note: this is a good way to get tired and/or grouchy
40
people to step on "those little buggers making that gosh-darned racket.")
41
	->The slavecode can be started by pushing button1.  This will
42
		turn on the BOM and start other slaves.
43

  
44

  
45
DISCLAIMER:
46
------------
47
The music library is cool and relatively accurate, but it can also
48
be insanely annoying.  Use it at your own risk and with discretion.
49

  

Also available in: Unified diff