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.
Dependents: 2ndYearProject-DistanceSensor
Fork of SRF02 by
SRF02 Class Reference
Library for interfacing with SRF02 Ultrasonic Sensor in I2C. More...
#include <SRF02.h>
Public Member Functions | |
SRF02 (PinName sdaPin, PinName sclPin) | |
Create a SRF02 object connected to the specified I2C pins. | |
int | getDistanceCm () |
Read distance in centimetres. | |
int | getDistanceInch () |
Read distance in inches. |
Detailed Description
Library for interfacing with SRF02 Ultrasonic Sensor in I2C.
Revision 1.0
- Date:
- March 2014
Example:
#include "mbed.h" #include "SRF02.h" int main() { while(1) { // read sensor distance in cm and print over serial port int distance = sensor.getDistanceCm(); serial.printf("Distance = %d cm\n",distance); // short delay before next measurement wait(0.5); } }
Definition at line 57 of file SRF02.h.
Constructor & Destructor Documentation
SRF02 | ( | PinName | sdaPin, |
PinName | sclPin | ||
) |
Member Function Documentation
int getDistanceCm | ( | ) |
Generated on Fri Jul 15 2022 03:02:49 by
