Project

General

Profile

Revision 274

Added by John Sexton over 16 years ago

Got put_usb functions working with battery functions. Code has formatted output of all 3 functions over usb.
Note: Make sure maud rate is correct in Tera Term to obtain usb output from robot.

View differences:

branches/battery/code/projects/template/main.c
1 1
#include <dragonfly_lib.h>
2
#include <battery.h>
2 3

  
4
int counter = 0;
5

  
3 6
int main(void) {
4 7
	dragonfly_init(ALL_ON);
5 8
	motors_init();
6
	
9
	usb_init();
10
	analog_init();
11

  
7 12
	while(1) {
8
	
9
	motor1_set(1, 255);
10
	motor2_set(1, 255);
11
	
13
		
14
		//Drain battery as fast as possible
15
		motor1_set(1, 255);
16
		motor2_set(1, 255);
17
		
18
		bom_on();
19
		
20
		//Prints out the results of three functions
21
/*		usb_puts("battery8_avg\(50\): ");
22
		usb_puti(battery8_avg(50));
23
		
24
		usb_puts("\t\t");
25
		
26
		usb_puts("battery8\(\): ");
27
*/		usb_puti(battery8());
28
		
29
/*		usb_puts("\t\t");
30
		
31
		usb_puts("battery\(\): ");
32
		usb_puti(battery());
33
		
34
*/		usb_puts("\r\n");
35
		
36
		delay_ms(100);
37
		
12 38
	}
13 39
	
14
	
15 40
	return 0;
16 41
}
42

  
branches/battery/code/projects/template/Makefile
14 14
# USE_WIRELESS = 1
15 15

  
16 16
# com1 = serial port. Use lpt1 to connect to parallel port.
17
AVRDUDE_PORT = com6
17
AVRDUDE_PORT = com2
18 18
#
19 19
#
20 20
###################################

Also available in: Unified diff