Project

General

Profile

Revision 331

Added by Chris Mar almost 15 years ago

rangefinders work w/ buffer.
new function names:
- analog8() = use buffer
- analog_get8() = direct

View differences:

main.c
1 1
#include "../libdragonfly/dragonfly_lib.h"
2 2

  
3 3
int main(void) {
4
	int count = 0;
4
	unsigned int count = 0;
5 5
	int count2 = 0;
6 6
	dragonfly_init(ALL_ON);
7
	
7
	range_init();
8
	//analog_stop_loop();
9
	usb_puts("starting");
8 10
	while (1) {
9
		if (count == 1000) {
10
			usb_puts("the value of the pot is: ");
11
			usb_puti(analog_get8(WHEEL_PORT));
12
			usb_puts("\t");
13
			usb_puti(analog_get10(WHEEL_PORT));
11
		if (count == 50000) {
12
			for(int i=2; i<7; i++) {
13
				usb_puti( linearize_distance(analog8(i)) );
14
				usb_puts("  ");
15
			}
14 16
			usb_puts("\n\r");
15 17
			count = 0;
16 18
		}
17
		
19
		/*
18 20
		if (count2 == 5000) {
19 21
			usb_puts("Loop stopped\n\r");
20 22
			analog_stop_loop();
......
24 26
			usb_puts("Loop started\n\r");
25 27
			analog_start_loop();
26 28
			count2 = 0;
27
		}
29
		}*/
28 30
		
29 31
		
30 32
		count++;
31
		count2++;
33
		//count2++;
32 34
	}
33 35
	
34 36
	return 0;

Also available in: Unified diff