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.
Homepage
RFD77402 ToF-sensor¶
I just ported the sourcecode provided by sparkfun (available on https://github.com/sparkfun/SparkFun_RFD77402_Arduino_Library) to the mbed-environment. So if you like it, please support them by e.g. buying a sparkfun-board, because in fact they did all the work :)
If you found any errors, please report them, I'm no professinal coder, so maybe there are some things I dindn't consider while porting the library.
The datasheet of the sensor is available at https://media.digikey.com/pdf/Data%20Sheets/RF%20Digital%20PDFs/RFD77402.pdf
The easiest way to use the sensor is e.g.:
RFD77402 MyDistance; //create an object-instance MyDistance.begin(i2c); //initialize the sensor MyDistance.takeMeasurement(); //tell sensor to take a measurement uint16_t distance = MyDistance.getDistance(); //get the last measurement result