Crude navigation
Dependencies: GPS L3GD20 LSM303DLHC mbed PID
Diff: move.h
- Revision:
- 0:e79311aae7ed
diff -r 000000000000 -r e79311aae7ed move.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/move.h Sat Feb 21 01:14:46 2015 +0000 @@ -0,0 +1,57 @@ +//L298n connections +DigitalOut pinI1(D5); +DigitalOut pinI2(D6); +DigitalOut pinI3(D10); +DigitalOut pinI4(D11); +PwmOut ENA(D12); //Left +PwmOut ENB(D13); //Right + +void goStop(float valueOne, float valueTwo) +{ + pinI1 = 0; + pinI2 = 0; + pinI3 = 0; + pinI4 = 0; + ENA = valueOne; + ENB = valueTwo; +} + +void goForward(float valueOne, float valueTwo) +{ + pinI1 = 1; + pinI2 = 0; + pinI3 = 0; + pinI4 = 1; + ENA = valueOne; + ENB = valueTwo; +} + +void goBackward(float valueOne, float valueTwo) +{ + pinI1 = 0; + pinI2 = 1; + pinI3 = 1; + pinI4 = 0; + ENA = valueOne; + ENB = valueTwo; +} + +void goLeft(float valueOne, float valueTwo) +{ + pinI1 = 0; + pinI2 = 1; + pinI3 = 0; + pinI4 = 1; + ENA = valueOne; + ENB = valueTwo; +} + +void goRight(float valueOne, float valueTwo) +{ + pinI1 = 1; + pinI2 = 0; + pinI3 = 1; + pinI4 = 0; + ENA = valueOne; + ENB = valueTwo; +}