Utils Boards  1.0.2
Utility functions and macros to uniform the usage of the WiFi and I2C across different boards
UtilsI2C.cpp File Reference
#include <Arduino.h>
#include <UtilsI2C.h>
#include <Utils.h>
#include <Wire.h>

Functions

void scanBus (TwoWire &bus)
 Scan a I2C bus for devices. More...
 
void scanBus (TwoWire &bus, Print &pr)
 Scan a I2C bus for devices. More...
 

Function Documentation

◆ scanBus() [1/2]

void scanBus ( TwoWire &  bus)

Scan a I2C bus for devices.

This function scans all the addresses (from 1 to 127) of the I2C bus using the return value of the Write.endTransmisstion.

When it finds a device prints to the default Serial port a message saying the a device was found on a specifc address.

Parameters
busthe I2C bus

◆ scanBus() [2/2]

void scanBus ( TwoWire &  bus,
Print &  pr 
)

Scan a I2C bus for devices.

This function scans all the addresses (from 1 to 127) of the I2C bus using the return value of the Write.endTransmisstion.

When it finds a device prints to the default Serial port a message saying the a device was found on a specifc address.

This function assumes that the Print argument is associated wit a small display (LCD ou OLED). So when a I2C device is found a small message is also printed in the display saying that a new device was found.

Parameters
busthe I2C bus
prArduino Print object that suports the print and println methods