Project

General

Profile

Revision 1419

Added by John Sexton over 11 years ago

Added a folder for developing Target Practice Demo.

View differences:

main.c
1 1
#include <dragonfly_lib.h>
2
#include <wireless.h>
3
#include <wl_basic.h>
4 2

  
5
#define CHAN 0xE	       /* channel to use for wireless communication */
6

  
7
unsigned char* packet;
8

  
9 3
int main(void)
10 4
{
5

  
11 6
	/* initialize components, set wireless channel */
12 7
	dragonfly_init(ALL_ON);
13
	wl_basic_init_default();
14
	wl_set_channel(CHAN);
8
	
9
	int val;
15 10

  
16 11
	while (1) {
17
		packet = wl_basic_do();
18
        if (packet != 0) {
19
            if (current_packet.length > 0) {
20
                if (packet[0] == 'r')
21
                    orb_set_color(RED);
22
                else if (packet[0] == 'b')
23
                    orb_set_color(BLUE);
24
            }
25
        }
26 12

  
27
		/* send a packet with no useful info for testing */
28
        if (button1_click() ) {
29
		    wl_basic_send_global_packet(1, "r", 2);
30
        }
31
        if (button2_click() ) {
32
		    wl_basic_send_global_packet(1, "b", 2);
33
        }
13
		usb_puts("Val: ");
14
		bom_refresh(BOM_ALL);
15
		usb_puti(bom_get_max());
16

  
17
		usb_putc('\n');
18

  
19
		delay_ms(200);
20

  
34 21
	}
35 22

  
36
	wl_terminate();
37

  
38 23
	return 0;
39 24
}
40 25

  

Also available in: Unified diff