EE149
/
FinalProject
Final Project files for mBed development.
control.c
- Committer:
- John Wilkey
- Date:
- 2014-11-13
- Revision:
- 6:00b7198f0b51
- Parent:
- 5:01882c3de2dc
- Child:
- 7:6e5cc24e1ce7
File content as of revision 6:00b7198f0b51:
/** * @file control.c * @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) { if(amt > 1) { spd = 1; } pi.forward(spd); wait(amt); return EXIT_SUCCESS; } int backward(float amt, float spd) { if(amt > 1) { spd = 1; } 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); }