SparkFun Qwiic Ultrasonic Distance Sensor  v1.1.2-13-g96f7fa8
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...
 
sfTkError_t begin (sfTkII2C *theBus=nullptr)
 Begins the Qwiic Ultrasonic sensor. More...
 
sfTkError_t triggerAndRead (uint16_t &distance)
 Triggers a new measurement and reads the previous one. More...
 
sfTkError_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

sfTkII2C * _theBus
 

Member Function Documentation

◆ begin() [1/2]

sfTkError_t sfDevUltrasonicDist::begin ( sfTkII2C *  theBus = nullptr)
inherited

Begins the Qwiic Ultrasonic sensor.

Parameters
theBusI2C bus to use for communication
Returns
0 for success, 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.

This method initializes the Qwiic Ultrasonic sensor by setting up the I2C bus and starting communication with the sensor.

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

◆ changeAddress()

sfTkError_t sfDevUltrasonicDist::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 sfDevUltrasonicDist::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.

This method verifies if the Qwiic Ultrasonic sensor is properly connected by checking the communication status.

Returns
True if the sensor is connected, false otherwise

◆ triggerAndRead()

sfTkError_t sfDevUltrasonicDist::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

sfTkII2C* sfDevUltrasonicDist::_theBus
protectedinherited

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