Revision 867
Added encoder test code to trunk. Addition of encoder code pending testing.
trunk/code/projects/test/testencoders.c | ||
---|---|---|
1 |
#include <dragonfly_lib.h> |
|
2 |
#include "spi.h" |
|
3 |
#include "encoders.h" |
|
4 |
|
|
5 |
#define MODE 0 |
|
6 |
#define TEST 0 |
|
7 |
|
|
8 |
extern char spi_status; |
|
9 |
|
|
10 |
int testencoders(void) |
|
11 |
{ |
|
12 |
usb_init(); |
|
13 |
encoders_init(); |
|
14 |
dragonfly_init(ALL_ON); |
|
15 |
int encoder_left,encoder_right; |
|
16 |
while(1){ |
|
17 |
|
|
18 |
encoder_left = encoder_read(LEFT); |
|
19 |
encoder_right = encoder_read(RIGHT); |
|
20 |
usb_puts("Encoder values (left, right): "); |
|
21 |
usb_puti(encoder_left); |
|
22 |
usb_puts(", "); |
|
23 |
usb_puti(encoder_right); |
|
24 |
usb_puts("\n\r"); |
|
25 |
delay_ms(500); |
|
26 |
} |
|
27 |
return 0; |
|
28 |
} |
|
29 |
|
trunk/code/projects/test/main.c | ||
---|---|---|
7 | 7 |
//testlcd(); |
8 | 8 |
//testrangefinders(); |
9 | 9 |
//testanalog(); |
10 |
testtokenring(); |
|
10 |
//testtokenring(); |
|
11 |
testencoders(); |
|
11 | 12 |
|
12 | 13 |
return 0; |
13 | 14 |
} |
Also available in: Unified diff