Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed HC_SR04_Ultrasonic_Library Nucleo_Sensor_Shield VL6180x_lib
Fork of Coupe Robotique FIP by
main.cpp
00001 #include "mbed.h" 00002 #include "ultrasonic.h" 00003 #include "VL6180x.h" 00004 #include "easyspin.h" 00005 00006 #define VL6180X_ADDRESS 0x29 00007 00008 Easyspin myEasyspin; 00009 DigitalInOut sdaDummy(D14); 00010 DigitalInOut sclDummy(D15); 00011 00012 VL6180xIdentification identification; 00013 // mbed uses 8bit addresses shift address by 1 bit left 00014 VL6180x sensor(D14, D15, VL6180X_ADDRESS<<1); 00015 00016 int main() 00017 { 00018 sdaDummy.mode(PullUp); 00019 sclDummy.mode(PullUp); 00020 myEasyspin.Begin(2); 00021 while(1) { 00022 if(sensor.getDistance()<255) { 00023 myEasyspin.Run(0, FORWARD); 00024 myEasyspin.Run(1, FORWARD); 00025 } else { 00026 myEasyspin.Run(0, FORWARD); 00027 myEasyspin.Run(1, BACKWARD); 00028 } 00029 wait_ms(200); 00030 } 00031 }
Generated on Sun Jul 17 2022 11:12:47 by
1.7.2
