This repository has been archived by the owner on Jun 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
reset()
Arnd edited this page Jun 22, 2018
·
3 revisions
This function writes a reset flag to the configuration register of the INA226 specified in the optional "deviceNumber" parameter, defaulting to resetting ALL devices that were located. This is a software reset, equivalent to turning it off and on again. The reset is fast, at 40 microseconds.
The INA226 will have the following default settings upon restart:
- Don't average readings
- Use a conversion speed of 1.1ms per Bus conversion
- Use a conversion speed of 1.1ms per Shunt conversion
- Continuously convert both Bus and Shunt measurements
- Clear the calibration register
The values for amps and watts will be returned as 0 since the calibration register has been cleared. The begin() function needs to be called again with the appropriate parameters to once again fill the calibration values.
INA226_Class INA226(); // Instantiate the class
void setup() {
INA226.begin(50,100000); // 5V bus with maximum current of 500mA
// A 0.1 Ohm shunt resistor generates 50mV max
int32_t busMicroAmps= INA226.getBusMicroAmps();
Serial.print("Bus amperage is ");
Serial.print((float)busMicroAmps/1000,3);
Serial.print(" mA\n");
INA226.reset()
int32_t busMicroAmps= INA226.getBusMicroAmps(); // value will now be 0
Serial.print("Bus amperage is ");
Serial.print((float)busMicroAmps/1000,3);
Serial.print(" mA\n");
} // of setup
void loop() {
} // of main loop