with the tof code
Dependencies: mbed Servo ros_lib_kinetic
Diff: main.cpp
- Revision:
- 2:6197e1cf2cd1
- Parent:
- 1:9bc7f95c3c7d
- Child:
- 3:df6160e2f6d9
--- a/main.cpp Thu Oct 24 13:35:54 2019 +0000 +++ b/main.cpp Thu Oct 24 14:24:27 2019 +0000 @@ -3,6 +3,7 @@ Description: Main program loop --------------------------------------------------------------------------------*/ #include "mbed.h" +#include "Motor.h" #include "TOF.h" Serial pc(SERIAL_TX, SERIAL_RX, 9600); // set-up serial to pc @@ -14,6 +15,7 @@ DigitalOut TOF7(PG_2); cAdafruit_VL6180X VL6180X(TOF1,TOF3,TOF5,TOF7); //Define TOF sensor class and initialise devices +cMotor LMotor(M1_PWM, M1_IN1, M1_IN2), RMotor(M2_PWM, M2_IN1, M2_IN2); /*-------------------------------------------------------------------------------- Function name: ServiceTOF @@ -49,6 +51,9 @@ uint8_t TOFRange[4]; //Array to store TOF measurements 0-sensor1, 1-sensor3, 2-sensor5, 3-sensor7 while(1) { + //LMotor.Backwards(0.2); + //RMotor.Backwards(0.2); + //Perform TOF measurements TOFRange[0] = serviceTOF(ADDR1); @@ -61,5 +66,6 @@ //Short delay wait(0.1); + } } \ No newline at end of file