|
Explore TEAMS!
|
Student /
MatthewFrykenbergsLineFollowingCode/*Matthew Frykenberg Line following lab*/ // Include the Command Module API
// Pointer to the Sensor Data structure cr8_t *cr8; // Main function int main(void) { // Allocate memory for sensor data structure
cr8 = cr8_alloc();
// Initialize the Create and Command Module
// Sync communications settings.
cr8_init(cr8);
// Start Robot Code Here
// |
// \|/
while(cr8->button_play ==0)
{
if(cr8->cliff_frontright_range <700)
{
cr8_set_leds(0,1,0,0);
cr8_drive_direct(50,-50);
cr8_update(cr8);
}
else if(cr8->cliff_frontleft_range <700)
{
cr8_drive_direct(-50,50);
cr8_set_leds(0,0,0,255);
cr8_update(cr8);
}
else
{
cr8_drive_direct(100,100);
cr8_set_leds(1,0,0,0);
cr8_update(cr8);
}
cr8_update(cr8);
cr8_delay(15);
}
cr8_drive_direct(0,0);
// release the sensor data strucutre memory and exit the program
cr8_free(cr8);
return 0;
} Make All: Compiling C: main.c avr-gcc -c -mmcu=atmega168 -I. -gdwarf-2 -DF_CPU=18432000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wundef -Wa,-adhlns=obj/main.lst -std=gnu99 -Wundef -MD -MP -MF .dep/main.o.d main.c -o obj/main.o main.c:54:2: warning: no newline at end of file Linking: main.elf avr-gcc -mmcu=atmega168 -I. -gdwarf-2 -DF_CPU=18432000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wundef -Wa,-adhlns=obj/create.o -std=gnu99 -Wundef -MD -MP -MF .dep/main.elf.d obj/create.o obj/main.o --output main.elf -Wl,-Map=main.map,--cref -lm Creating load file for Flash: main.hex avr-objcopy -O ihex -R .eeprom main.elf main.hex Creating load file for EEPROM: main.eep avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex main.elf main.eep c:\WinAVR-20070525\bin\avr-objcopy.exe: there are no sections to be copied! c:\WinAVR-20070525\bin\avr-objcopy.exe: --change-section-lma .eeprom=0x00000000 never used make.exe: [main.eep] Error 1 (ignored) Creating Extended Listing: main.lss avr-objdump -h -S main.elf > main.lss Creating Symbol Table: main.sym avr-nm -n main.elf > main.sym Size after: main.elf : section size addr .data 6 8388864 .text 5348 0 .bss 18 8388870 .stab 888 0 .stabstr 113 0 .debug_aranges 64 0 .debug_pubnames 758 0 .debug_info 5247 0 .debug_abbrev 784 0 .debug_line 4309 0 .debug_frame 544 0 .debug_str 1572 0 .debug_loc 943 0 Total 20594 end -------- > Process Exit Code: 0 > Time Taken: 00:03 |