EE149
/
FinalProject
Final Project files for mBed development.
Diff: main.c
- Revision:
- 28:9976a94efa83
- Parent:
- 27:44a4a0abc8ee
- Child:
- 29:459ff10d2a07
--- a/main.c Mon Dec 08 05:00:23 2014 +0000 +++ b/main.c Mon Dec 08 10:52:42 2014 +0000 @@ -178,11 +178,17 @@ offset = instbuf+instbuflen-cur-1; memcpy(instbuf, cur, offset); while (1) { + timerWait(1); memset(instbuf+offset, 0, instbuflen-offset); bytes_read = fread(instbuf+offset, sizeof(char), instbuflen-1-offset, ps_file); + if (instbuf[0] == '\0') { - break; + pi.cls(); + pi.locate(0,0); + pi.printf("%s", instbuf+1); + while(1); } + cur = instbuf; err = retrieve_inst(instbuf, &x, &y, &draw); if (err == 0) { @@ -204,7 +210,13 @@ if (delta_x < 0 && delta_y < 0) { delta_a += 180; } + if (delta_a > 180) { + delta_a -= 360; + } angle += delta_a; + if (angle >= 360) { + angle -= 360; + } //pi.cls(); //pi.locate(0,0); //pi.printf("a:%f", delta_a); @@ -213,9 +225,9 @@ /* Put pen into position. */ if (draw) { - oled_1 = 1; + oled_3 = 1; } else { - oled_1 = 0; + oled_3 = 0; } /* Compute drive time and move forward. */