root / trunk / code / behaviors / james / main.c @ 1519
History | View | Annotate | Download (1022 Bytes)
1 | 1519 | jykong | /*
|
---|---|---|---|
2 | * template.c - A starting point for developing behaviors using the Colony
|
||
3 | * robots. To create a new behavior, you should copy this "template"
|
||
4 | * folder to another folder and rename the "template.c" file
|
||
5 | * appropriately.
|
||
6 | *
|
||
7 | * This template will have the robot drive in circles and flash the orbs.
|
||
8 | *
|
||
9 | * Author: John Sexton, Colony Project, CMU Robotics Club
|
||
10 | */
|
||
11 | |||
12 | #include <dragonfly_lib.h> |
||
13 | #include <wl_basic.h> |
||
14 | |||
15 | /* Time delay which determines how long the robot circles before it
|
||
16 | * changes direction. */
|
||
17 | #define TIME_DELAY 5000 |
||
18 | |||
19 | int main (void) { |
||
20 | |||
21 | /* Initialize the dragonfly boards, the xbee, and the encoders */
|
||
22 | dragonfly_init(ALL_ON); |
||
23 | xbee_init(); |
||
24 | encoders_init(); |
||
25 | |||
26 | while (1) { |
||
27 | /* Drive left, set orbs, and wait */
|
||
28 | orbs_set_color(RED, GREEN); |
||
29 | motor_l_set(FORWARD, 160);
|
||
30 | motor_r_set(FORWARD, 255);
|
||
31 | delay_ms(TIME_DELAY); |
||
32 | |||
33 | /* Drive right, change orb colors, and wait */
|
||
34 | orbs_set_color(PURPLE, BLUE); |
||
35 | motor_l_set(FORWARD, 255);
|
||
36 | motor_r_set(FORWARD, 160);
|
||
37 | delay_ms(TIME_DELAY); |
||
38 | } |
||
39 | |||
40 | } |