root / trunk / code / behaviors / template / main.c @ 1500
History | View | Annotate | Download (1022 Bytes)
1 | 1500 | jsexton | /*
|
---|---|---|---|
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 | 1156 | deffi | #include <dragonfly_lib.h> |
13 | 1498 | jsexton | #include <wl_basic.h> |
14 | 1156 | deffi | |
15 | 1500 | jsexton | /* Time delay which determines how long the robot circles before it
|
16 | * changes direction. */
|
||
17 | 1498 | jsexton | #define TIME_DELAY 5000 |
18 | 1156 | deffi | |
19 | 1498 | jsexton | int main (void) { |
20 | 1156 | deffi | |
21 | 1500 | jsexton | /* Initialize the dragonfly boards, the xbee, and the encoders */
|
22 | 1498 | jsexton | dragonfly_init(ALL_ON); |
23 | xbee_init(); |
||
24 | encoders_init(); |
||
25 | 1156 | deffi | |
26 | 1498 | jsexton | while (1) { |
27 | 1500 | jsexton | /* Drive left, set orbs, and wait */
|
28 | 1498 | jsexton | orbs_set_color(RED, GREEN); |
29 | motor_l_set(FORWARD, 160);
|
||
30 | motor_r_set(FORWARD, 255);
|
||
31 | delay_ms(TIME_DELAY); |
||
32 | 1156 | deffi | |
33 | 1500 | jsexton | /* Drive right, change orb colors, and wait */
|
34 | 1498 | jsexton | orbs_set_color(PURPLE, BLUE); |
35 | motor_l_set(FORWARD, 255);
|
||
36 | motor_r_set(FORWARD, 160);
|
||
37 | delay_ms(TIME_DELAY); |
||
38 | 1156 | deffi | } |
39 | |||
40 | } |