EE149
/
FinalProject
Final Project files for mBed development.
Diff: control.c
- Revision:
- 5:01882c3de2dc
- Parent:
- 4:13c13a098d2b
- Child:
- 6:00b7198f0b51
--- a/control.c Thu Nov 13 01:46:51 2014 +0000 +++ b/control.c Wed Nov 12 23:48:26 2014 -0500 @@ -1,3 +1,43 @@ /** * @file control.c - */ \ No newline at end of file + * @brief Motor control functions implemented from project.h + * @author John Wilkey + */ + +#include "project.h" +extern pi; +extern out_pins; + +int forward(float amt, float spd) +{ + pi.forward(spd); + wait(amt); + return EXIT_SUCCESS; +} + +int backward(float amt, float spd) +{ + pi.backward(spd); + wait(amt); + return EXIT_SUCCESS; +} + +int right(float deg) +{ + pi.right(TURN_SPEED); + wait(deg/360); + return EXIT_SUCCESS; +} + +int left(float deg) +{ + pi.left(TURN_SPEED); + wait(deg/360); + return EXIT_SUCCESS; +} + +void pretty_print(char* msg) +{ + pi.locate(0,1); + pi.printf(msg); +}