root / trunk / code / behaviors / formation_control / circle_spacing / circle_spacing.c @ 1558
History | View | Annotate | Download (745 Bytes)
1 | 1558 | gnagaraj | #include <dragonfly_lib.h> |
---|---|---|---|
2 | #include <wl_basic.h> |
||
3 | #include<encoders.h> |
||
4 | |||
5 | int main(void) |
||
6 | { |
||
7 | |||
8 | |||
9 | |||
10 | /* Initialize dragonfly board */
|
||
11 | |||
12 | dragonfly_init(ALL_ON); |
||
13 | xbee_init(); |
||
14 | wl_basic_init_default(); |
||
15 | wl_set_channel(12);
|
||
16 | int data_length;
|
||
17 | unsigned char *packet_data=wl_basic_do_default(&data_length); |
||
18 | int distance=24;//packet_data[0]; |
||
19 | encoder_rst_dx(RIGHT); |
||
20 | while(encoder_get_x(RIGHT)<=distance){
|
||
21 | bom_refresh(BOM_ALL); |
||
22 | |||
23 | orb1_set_color(BLUE); |
||
24 | |||
25 | if(bom_get_max()+1==8){ |
||
26 | orb1_set_color(RED); |
||
27 | motor_r_set(FORWARD,180);
|
||
28 | motor_l_set(FORWARD,180);
|
||
29 | |||
30 | } |
||
31 | else {
|
||
32 | motor_l_set(FORWARD,0);
|
||
33 | motor_r_set(FORWARD,180);
|
||
34 | } |
||
35 | |||
36 | } |
||
37 | motor_r_set(FORWARD,0);
|
||
38 | motor_l_set(FORWARD,0);
|
||
39 | while(1); |
||
40 | |||
41 | return 0; |
||
42 | |||
43 | |||
44 | |||
45 | |||
46 | } |
||
47 |