For coursework of group 3 in SOFT564Z
Dependencies: Motordriver ros_lib_kinetic
Diff: Motors.cpp
- Revision:
- 1:6a10e58b3d43
- Parent:
- 0:3dfee562823a
- Child:
- 3:7da9888ac8dc
--- a/Motors.cpp Wed Nov 27 18:28:06 2019 +0000 +++ b/Motors.cpp Thu Nov 28 11:56:51 2019 +0000 @@ -200,13 +200,14 @@ B.speed(bpwm); pc.printf("Driving: A target is: %d B target is: %d\n\r", atarget, btarget); pc.printf("Driving: A target was: %d B target was: %d\n\r", aprevtarget, bprevtarget); - ////// - //TEST CODE - ////// + /**************************************************************************/ + //Note that this code prevents consecutive movement commands from being executed until the + //previous one is done, but has the downside of keeping the thread busy during movement. + //Feel free to replace it with a different method of waiting, if you want. while(nextmoveflagA == 0 || nextmoveflagB == 0) { wait_ms(500); } - ////// + /**************************************************************************/ //update the recordings of the previous command's movement targets aprevtarget = atarget; bprevtarget = btarget;