Home - Getting Started - Constructor - Initialization - Functions - Examples
Basic Initialization - Initialize Wire Yes/No - Custom Address - Custom Address and Initialize Wire Yes/No - Custom Wire - Custom Wire and Address - Custom Wire, Address and Initialize Wire Yes/No
Custom Address and Initialize Wire Yes/No
Description
Performs an initialization of the library, using the specified device address, allowing you to also specify whether or not a call to Wire.begin()
is made. If allowed, the default SDA and SCL pins for your board are used.
Parameters
initializeWire : bool
address : uint8_t
Returns
successful: bool
Example
#include <MAX17043.h>
void setup()
{
Serial.begin(9600);
//
// Initialize Wire.
//
Wire.begin();
//
// Initialize the fuel gauge with a device address
// of 0x32.
//
FuelGauge.begin(false, 0x32);
}
void loop()
{
Serial.print("Battery percentage is ");
Serial.print(_fuelGauge.percent());
}
or
#include <MAX1704X.h>
MAX1704X _fuelGauge = MAX1704X(MAX17043_mV);
void setup()
{
Serial.begin(9600);
//
// Initialize Wire.
//
Wire.begin();
//
// Initialize the fuel gauge with a device address
// of 0x32.
//
_fuelGauge.begin(false, 0x32);
}
void loop()
{
Serial.print("Battery percentage is ");
Serial.print(_fuelGauge.percent());
}
Notes
None