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 Servo ros_lib_kinetic
Diff: TOFs/TOF.cpp
- Revision:
- 10:276cc357015c
- Parent:
- 4:36a04230554d
--- a/TOFs/TOF.cpp Sat Jan 04 21:35:25 2020 +0000 +++ b/TOFs/TOF.cpp Sun Jan 05 21:47:14 2020 +0000 @@ -9,28 +9,6 @@ I2C i2c(I2C_SDA, I2C_SCL); // Set up I²C on the STM board /*-------------------------------------------------------------------------------- -Function name: ServiceTOF -Input Parameters: address - address of target TOF sensor -Output Parameters: range - distance measurement in mm -Description: performs measurement routine on a given sensor -----------------------------------------------------------------------------------*/ -uint8_t serviceTOF(cAdafruit_VL6180X VL6180X, uint8_t address){ - - uint8_t range = 0; - - // poll the VL6180X till new sample ready - VL6180X.Poll_Range(address); - - // read range result - range = VL6180X.Read_Range(address); - - // clear the interrupt on VL6180X - VL6180X.Clear_Interrupts(address); - - return range; -} - -/*-------------------------------------------------------------------------------- Function name: cAdafruit_VL6180X Input Parameters: N/A Output Parameters: N/A @@ -57,23 +35,23 @@ //Enable and configure sensor 2 sensor2 = 1; wait(0.01); - Setup(DEFAULT_ADDR, ADDR4); //Change address - Init(ADDR4); //Perform standard initialisation routine - Start_Range(ADDR4); //Begin sampling in continuous mode + Setup(DEFAULT_ADDR, ADDR2); //Change address + Init(ADDR2); //Perform standard initialisation routine + Start_Range(ADDR2); //Begin sampling in continuous mode //Enable and configure sensor 3 sensor3 = 1; wait(0.01); - Setup(DEFAULT_ADDR, ADDR6); //Change address - Init(ADDR6); //Perform standard initialisation routine - Start_Range(ADDR6); //Begin sampling in continuous mode + Setup(DEFAULT_ADDR, ADDR3); //Change address + Init(ADDR3); //Perform standard initialisation routine + Start_Range(ADDR3); //Begin sampling in continuous mode //Enable and configure sensor 4 sensor4 = 1; wait(0.01); - Setup(DEFAULT_ADDR, ADDR7); //Change address - Init(ADDR7); //Perform standard initialisation routine - Start_Range(ADDR7); //Begin sampling in continuous mode + Setup(DEFAULT_ADDR, ADDR4); //Change address + Init(ADDR4); //Perform standard initialisation routine + Start_Range(ADDR4); //Begin sampling in continuous mode printf("INITIALISED\n\r"); }