root / trunk / code / projects / colonet / testing / robot_routine_reg_test / robot_routine_reg_test.c @ 13
History | View | Annotate | Download (812 Bytes)
1 |
/** @file robot_route_reg_test.c
|
---|---|
2 |
* @author Eugene Marinelli
|
3 |
* @brief Tests function registration in the colonet.h robot library
|
4 |
*/
|
5 |
|
6 |
#include <firefly+_lib.h> |
7 |
|
8 |
#include <colonet_robot/colonet.h> |
9 |
#include <serial.h> |
10 |
|
11 |
#include "wl_adhoc.h" |
12 |
|
13 |
void f0_handler(void) |
14 |
{ |
15 |
static int color = 0; |
16 |
color = !color; |
17 |
|
18 |
if (color) {
|
19 |
orb_set(0,255,0); |
20 |
} else {
|
21 |
orb_set(255,0,255); |
22 |
} |
23 |
|
24 |
buzzer_init(); |
25 |
delay_ms(200);
|
26 |
buzzer_off(); |
27 |
} |
28 |
|
29 |
int main(void) { |
30 |
analog_init(); |
31 |
led_init(); |
32 |
orb_init(); |
33 |
motors_init(); |
34 |
buzzer_init(); |
35 |
lcd_init(); |
36 |
wl_init(); |
37 |
|
38 |
serial_init(BAUD115200); |
39 |
serial1_init(BAUD115200); |
40 |
|
41 |
fdevopen(&serial1_putchar, &serial1_getchar); |
42 |
|
43 |
orb_set(255,0,0); |
44 |
|
45 |
colonet_add_message(0xF0, f0_handler);
|
46 |
|
47 |
orb_set(0,0,255); |
48 |
|
49 |
while(1){ |
50 |
parse_buffer(); |
51 |
} |
52 |
|
53 |
return 0; |
54 |
} |