EE149
/
FinalProject
Final Project files for mBed development.
control.c
- Committer:
- lsaristo
- Date:
- 2014-11-28
- Revision:
- 14:41fa8b95a9ab
- Parent:
- 12:1aa6b8a74136
File content as of revision 14:41fa8b95a9ab:
/** * @file control.c * @brief Implemention of robot control algorithms. * * This file should also contain the logic needed to parse * any drawing file and issue motor commands through functions * defined in main.h * * @author John Wilkey */ #include "control.h" #include "main.h" extern m3pi pi; extern DigitalIn start_button; extern DigitalOut oled_2; void get_ps_file(char* moves) { LocalFileSystem local("local"); FILE* fp = fopen(_CANVAS_FILE, "r"); fseek(fp, 0L, SEEK_END); int size = ftell(fp); fseek(fp, 0L, SEEK_SET); fread(moves, size, 1, fp); fclose(fp); } void robot_loop() { start: pi.cls(); pi.locate(0,0); pi.printf("PiCO"); pi.locate(0,1); pi.printf("%f mV", pi.battery()); wait(.5); while(start_button) { oled_2 = 1; wait(.5); pi.locate(0,0); pi.printf("Ready"); oled_2 = 0; } pi.cls(); pi.locate(0,0); pi.printf("GO!"); wait(.5); while(1) { if(!start_button) { pi.stop(); goto start; } forward(10); right(90); // // Right now the robot controller is clearly a very basic // 'hello world' loop that must be changed. } }