Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / test / testanalog.c @ 1120

History | View | Annotate | Download (629 Bytes)

1 800 jsexton
#include <dragonfly_lib.h>
2
3 831 jsexton
/*
4
 * This function outputs to TeraTerm a table which displays the values currently
5
 * stored in the analog table
6
 */
7
8 800 jsexton
int testanalog(void) {
9
10 827 dsschult
        dragonfly_init(ANALOG);
11 831 jsexton
12 800 jsexton
        usb_init();
13 830 jsexton
        usb_puts("usb turned on\r\n");
14 831 jsexton
15
        range_init();
16
        usb_puts("rangefinders initialized\r\n");
17
18
        usb_puts("\r\n\n");
19 827 dsschult
        delay_ms(1000);
20 800 jsexton
21
        while (1) {
22 830 jsexton
23
                for (int i = 0; i < 20; i++) {
24 800 jsexton
25 830 jsexton
                        usb_puts("\r\n");
26
27
                }
28
29 831 jsexton
                usb_puts("port# |\tvalue\r\n");
30 830 jsexton
31 831 jsexton
                for (int j = 1; j < 16; j++) {
32 800 jsexton
33 831 jsexton
                        usb_puti(j);
34
                        usb_puts("\t");
35
                        usb_puti(analog10(j));
36
                        usb_puts("\r\n");
37 830 jsexton
38 800 jsexton
                }
39
40 831 jsexton
                delay_ms(575);
41 830 jsexton
42 800 jsexton
        }
43
44
        return 0;
45
}