SparkFun Qwiic Ultrasonic Distance Sensor  v1.1.2-5-gc1d2217
SparkFun Qwiic Ultrasonic Distance Sensor
Loading...
Searching...
No Matches
QwiicUltrasonic Class Reference

#include <SparkFun_Qwiic_Ultrasonic_Arduino_Library.h>

Inheritance diagram for QwiicUltrasonic:

Public Member Functions

bool begin (uint8_t address=kQwiicUltrasonicDefaultAddress, TwoWire &wirePort=Wire)
 Begins the Qwiic Ultrasonic sensor. More...
 
bool isConnected ()
 Checks if the Qwiic Ultrasonic sensor is connected. More...
 
sfeTkError_t begin (sfeTkII2C *theBus=nullptr)
 Begins the Qwiic Ultrasonic sensor. More...
 
sfeTkError_t triggerAndRead (uint16_t &distance)
 Triggers a new measurement and reads the previous one. More...
 
sfeTkError_t changeAddress (uint8_t &address)
 Changes the I2C address of older Qwiic Ultrasonic sensors. More...
 
uint8_t getAddress ()
 Gets the current I2C address being used by the library for the Qwiic Ultrasonic sensor. More...
 

Protected Attributes

sfeTkII2C * _theBus
 

Member Function Documentation

◆ begin() [1/2]

sfeTkError_t sfeQwiicUltrasonic::begin ( sfeTkII2C *  theBus = nullptr)
inherited

Begins the Qwiic Ultrasonic sensor.

Parameters
theBusI2C bus to use for communication
Returns
0 for succuss, negative for errors, positive for warnings

◆ begin() [2/2]

bool QwiicUltrasonic::begin ( uint8_t  address = kQwiicUltrasonicDefaultAddress,
TwoWire &  wirePort = Wire 
)
inline

Begins the Qwiic Ultrasonic sensor.

Parameters
addressI2C device address to use for the sensor
wirePortWire port to use for I2C communication
Returns
True if successful, false otherwise

◆ changeAddress()

sfeTkError_t sfeQwiicUltrasonic::changeAddress ( uint8_t &  address)
inherited

Changes the I2C address of older Qwiic Ultrasonic sensors.

Parameters
addressNew address, must be in the range 0x20 to 0x2F
Returns
0 for succuss, negative for errors, positive for warnings

◆ getAddress()

uint8_t sfeQwiicUltrasonic::getAddress ( )
inherited

Gets the current I2C address being used by the library for the Qwiic Ultrasonic sensor.

Returns
The current I2C address, 7-bit unshifted

◆ isConnected()

bool QwiicUltrasonic::isConnected ( )
inline

Checks if the Qwiic Ultrasonic sensor is connected.

Returns
True if the sensor is connected, false otherwise

◆ triggerAndRead()

sfeTkError_t sfeQwiicUltrasonic::triggerAndRead ( uint16_t &  distance)
inherited

Triggers a new measurement and reads the previous one.

Parameters
distanceDistance in mm
Returns
0 for succuss, negative for errors, positive for warnings

Member Data Documentation

◆ _theBus

sfeTkII2C* sfeQwiicUltrasonic::_theBus
protectedinherited

The documentation for this class was generated from the following file: