Project

General

Profile

Revision 1874

Added by John Sexton over 13 years ago

Removed unnecessary tools folder from linefollowing branch.

View differences:

branches/linefollowing/tools/eeprom/Makefile
1
# this is a local makefile
2

  
3
# Relative path to the root directory (containing lib directory)
4
#ifndef COLONYROOT
5
COLONYROOT = ..
6

  
7
# Target file name (without extension).
8
TARGET = main
9

  
10
# Uncomment this to use the wireless library
11
#USE_WIRELESS = 1
12

  
13
# com1 = serial port. Use lpt1 to connect to parallel port.
14
AVRDUDE_PORT = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'COM4:'; else echo '/dev/ttyUSB0'; fi)
15

  
16
#else
17
COLONYROOT := ../$(COLONYROOT)
18
#endif
19

  
20
include $(COLONYROOT)/Makefile
branches/linefollowing/tools/eeprom/program_eeprom.c
1
#include <dragonfly_lib.h>
2
#include <eeprom.h>
3

  
4
int main()
5
{
6
  char str[5];
7
  int i=0,id;
8
  char c;
9

  
10
  dragonfly_init(ALL_ON);
11

  
12
  usb_puts("Here is the current setup:\r\n  ID: ");
13
  itoa(get_robotid(), str, 10);
14
  usb_puts(str);
15
  usb_puts("\r\n  BOM type: ");
16
  itoa(get_bom_type(), str, 10);
17
  usb_puts(str);
18
  usb_puts("\r\n\r\nEnter new ID:");
19

  
20
  while((c = usb_getc()) != '\n' && c != '\r')
21
    {
22
      usb_putc(c);
23
      if(i>=4)
24
	{
25
	  usb_puts("ERROR: filled buffer\n");
26
	  while(1);
27
	}
28
      str[i++] = c;
29
    }
30
  while(i<5)
31
    str[i++] = 0;
32

  
33
  id = atoi(str);
34

  
35
  usb_puts("\r\nsetting new id to: ");
36
  usb_puti(id);
37

  
38

  
39
  eeprom_put_byte(EEPROM_ROBOT_ID_ADDR, 'I');
40
  eeprom_put_byte(EEPROM_ROBOT_ID_ADDR+1, 'D');
41
  eeprom_put_byte(EEPROM_ROBOT_ID_ADDR+2, id);
42

  
43

  
44
  usb_puts("\r\nEnter BOM type:\r\b"
45
	   "1 for BOM 1.0\r\n"
46
	   "5 for BOM 1.5\r\n"
47
	   "r for RBOM\r\n>");
48

  
49
  c = usb_getc();
50
  usb_putc(c);
51

  
52
  switch(c)
53
    {
54
    case '1': id = BOM10; break;
55
    case '5': id = BOM15; break;
56
    case 'r': id = RBOM; break;
57
    default:
58
      usb_puts("ERROR: invalid input");
59
      while(1);
60
    }
61

  
62
  eeprom_put_byte(EEPROM_BOM_TYPE_ADDR, 'B');
63
  eeprom_put_byte(EEPROM_BOM_TYPE_ADDR+1, 'O');
64
  eeprom_put_byte(EEPROM_BOM_TYPE_ADDR+2, 'M');
65
  eeprom_put_byte(EEPROM_BOM_TYPE_ADDR+3, id);
66

  
67

  
68

  
69
  usb_puts("\r\ndone! have a nice day\r\n");
70

  
71

  
72
  while(1);
73

  
74
  return 0;
75
}
76
  
branches/linefollowing/tools/rangefinders/Makefile
1
# this is a local makefile
2

  
3
# Relative path to the root directory (containing lib directory)
4
ifndef COLONYROOT
5
COLONYROOT := ..
6

  
7
# Target file name (without extension).
8
TARGET = 
9

  
10
# Uncomment this to use the wireless library
11
USE_WIRELESS = 1
12

  
13
# com1 = serial port. Use lpt1 to connect to parallel port.
14
AVRDUDE_PORT = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'COM4:'; else echo '/dev/ttyUSB0'; fi)
15

  
16
else
17
COLONYROOT := ../$(COLONYROOT)
18
endif
19

  
20
include $(COLONYROOT)/Makefile
branches/linefollowing/tools/rangefinders/robot/testIRcycle.c
1
#include <dragonfly_lib.h>
2

  
3
int main(void)
4
{
5
	/* initialize components, set wireless channel */
6
	dragonfly_init(ALL_ON);
7
	
8
  //Replace the next two lines with your own code
9
  //You can add as many lines as you want
10
  
11
  uint8_t rangeNumber[] = {IR1,IR2,IR3,IR4,IR5}; //0 indexed
12
  uint8_t cIndex;
13
  
14
  //initial setup (IR1)
15
  cIndex=0;
16
  orb1_set_color(BLUE);
17
  orb2_set_color(GREEN);
18
  
19
	while(1) {
20
		
21
		usb_puti(range_read_distance(rangeNumber[cIndex]));
22
		usb_putc('\r');
23
		
24
		if (button1_click()) {
25
			switch (cIndex){ //button1 chooses a color channel
26
				case 0: //IR1
27
					orb1_set_color(RED);
28
					orb2_set_color(RED);
29
					cIndex=1;
30
					break;
31
				case 1: //IR2
32
					
33
					orb1_set_color(GREEN);
34
					orb2_set_color(GREEN);
35
					cIndex=2;
36
					break;
37
				case 2: //IR3
38
					
39
					orb1_set_color(BLUE);
40
					orb2_set_color(BLUE);
41
					cIndex=3;
42
					break;
43
				case 3: //IR4
44
					orb1_set_color(YELLOW);
45
					orb2_set_color(YELLOW);
46
					cIndex=4;
47
					break;	
48
				case 4: //IR5
49
					orb1_set_color(BLUE);
50
					orb2_set_color(GREEN);
51
					cIndex=0;
52
					break;
53
				default: //undefined
54
					return 0;
55
					break;
56
			}
57
			delay_ms(50); //allows button press to release
58
		}
59
		delay_ms(50); //refresh frequency: 1000/(50ms) refresh rate
60

  
61
	}
62
		
63
		
64
	
65
  //this tell the robot to just chill out forever. don't put anything after this
66
  while(1);
67
	return 0;
68
}
branches/linefollowing/tools/rangefinders/robot/Makefile
1
# this is a local makefile
2

  
3
# Relative path to the root directory (containing lib directory)
4
ifndef COLONYROOT
5
COLONYROOT := ..
6

  
7
# Target file name (without extension).
8
TARGET = testIRcycle
9

  
10
# Uncomment this to use the wireless library
11
USE_WIRELESS = 1
12

  
13
# com1 = serial port. Use lpt1 to connect to parallel port.
14
AVRDUDE_PORT = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'COM4:'; else echo '/dev/ttyUSB0'; fi)
15

  
16
else
17
COLONYROOT := ../$(COLONYROOT)
18
endif
19

  
20
include $(COLONYROOT)/Makefile
branches/linefollowing/tools/Makefile
1
# this is a local makefile
2

  
3
# Relative path to the root directory (containing lib directory)
4
ifndef COLONYROOT
5
COLONYROOT := ..
6

  
7
# Target file name (without extension).
8
TARGET = main
9

  
10
# Uncomment this to use the wireless library
11
USE_WIRELESS = 1
12

  
13
# com1 = serial port. Use lpt1 to connect to parallel port.
14
AVRDUDE_PORT = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'COM4:'; else echo '/dev/ttyUSB0'; fi)
15

  
16
else
17
COLONYROOT := ../$(COLONYROOT)
18
endif
19

  
20
include $(COLONYROOT)/Makefile

Also available in: Unified diff