Library for the SRF02 ultrasonic rangefinder

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

SRF02 Class Reference

SRF02 Class Reference

Library for the SRF02 Ultrasonic Ranger. More...

#include <SRF02.h>

Public Member Functions

 SRF02 (PinName sda, PinName scl, int addr)
 Create a SRF02 object connected to the specified I2C pins.
 ~SRF02 ()
 Destroys an instance of SRD02.
float measurecm ()
 Get the current distance in centimetres.
float measurein ()
 Get the current distance in centimetres.
float measureus ()
 Get the current distance in centimetres.

Detailed Description

Library for the SRF02 Ultrasonic Ranger.

Definition at line 52 of file SRF02.h.


Constructor & Destructor Documentation

SRF02 ( PinName  sda,
PinName  scl,
int  addr 
)

Create a SRF02 object connected to the specified I2C pins.

Parameters:
sdaI2C Data pin to connect to
sclI2C Clock pin to connect to

Definition at line 8 of file SRF02.cpp.

~SRF02 (  )

Destroys an instance of SRD02.

Definition at line 12 of file SRF02.cpp.


Member Function Documentation

float measurecm (  )

Get the current distance in centimetres.

Parameters:
returnsthe measured distance in centimetres as a float

Definition at line 16 of file SRF02.cpp.

float measurein (  )

Get the current distance in centimetres.

Parameters:
returnsthe measured distance in inches as a float

Definition at line 26 of file SRF02.cpp.

float measureus (  )

Get the current distance in centimetres.

Parameters:
returnsthe time of flight from the pulse sent from the sensor in microseconds (uS) as a float

Definition at line 21 of file SRF02.cpp.