receiver code which helps the vehicle to move forward, backward, left and right
Dependencies: mbed Servo mbed-rtos XBeeTest Motor emic2 X_NUCLEO_53L0A1
Diff: main.cpp
- Revision:
- 2:112ca6a4fc73
- Parent:
- 1:95f5ac2f045d
- Child:
- 3:5d43739ec09f
--- a/main.cpp Wed Dec 05 22:46:10 2018 +0000 +++ b/main.cpp Wed Dec 05 23:08:58 2018 +0000 @@ -14,7 +14,6 @@ #define VL53L0_I2C_SCL p27 static XNucleo53L0A1 *board=NULL; -DigitalOut shdn(p26); emic2 myTTS(p13, p14); Serial xbee1(p9, p10); DigitalOut rst1(p11); @@ -42,14 +41,6 @@ pc.printf("Failed to init board! \r\n"); status = board->init_board(); } - //loop taking and printing distance - while (1) { - status = board->sensor_centre->get_distance(&distance); - if (status == VL53L0X_ERROR_NONE) { - pc.printf("D=%ld mm\r\n", distance); - } - } - myTTS.volume(2); @@ -70,6 +61,10 @@ A.speed(0); B.speed(0); + status = board->sensor_centre->get_distance(&distance); + if (status == VL53L0X_ERROR_NONE) { + pc.printf("D=%ld mm\r\n", distance); + } if (input == 'A') { myTTS.speakf("S");//Speak command starts with "S" @@ -109,7 +104,7 @@ } else if (input == 'E') { myTTS.speakf("S");//Speak command starts with "S" - myTTS.speakf("stop, open vicinity warning system"); + myTTS.speakf("stop"); myTTS.speakf("\r"); //marks end of speak command myTTS.ready(); A.speed(0);