test program

Dependencies:   LSM9DS1_Library2 MotorV2 SRF05 Tracker2 mbed nRF24L01P

Fork of DUMP_TRUCK_SPR2017 by Terrabots

Committer:
simplyellow
Date:
Tue Mar 14 20:10:27 2017 +0000
Revision:
11:87f30625b213
Parent:
10:cf77da9be0b8
Child:
13:112b6543909a
dump truck stops as expected when within 20cm of an object (from front).

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simplyellow 10:cf77da9be0b8 1 #include "DumpTruck.h"
simplyellow 10:cf77da9be0b8 2 DumpTruck dump(1);
Josahty 0:6942f0e2198c 3
simplyellow 10:cf77da9be0b8 4 /*
simplyellow 10:cf77da9be0b8 5 test code for driving and stopping when an object gets too close
simplyellow 10:cf77da9be0b8 6 to the dump truck.
simplyellow 10:cf77da9be0b8 7 */
simplyellow 5:dc4cf6cc24b3 8
simplyellow 10:cf77da9be0b8 9 int main() {
simplyellow 11:87f30625b213 10
simplyellow 11:87f30625b213 11 while(1) {
simplyellow 11:87f30625b213 12 printf("%f\r\n",(float)dump.detect());
simplyellow 10:cf77da9be0b8 13 if(dump.detect()) {
simplyellow 10:cf77da9be0b8 14 dump.stop();
simplyellow 10:cf77da9be0b8 15 } else {
simplyellow 10:cf77da9be0b8 16 dump.drive(0.5f);
simplyellow 10:cf77da9be0b8 17 }
simplyellow 5:dc4cf6cc24b3 18 }
simplyellow 10:cf77da9be0b8 19
simplyellow 5:dc4cf6cc24b3 20 }
simplyellow 11:87f30625b213 21