Project

General

Profile

Statistics
| Revision:

root / trunk / code / behaviors / tetris_dance / slavecode / lab0.c @ 2000

History | View | Annotate | Download (3.45 KB)

1 2000 azl
#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
}