Skip to content
This repository was archived by the owner on Jun 22, 2018. It is now read-only.

getShuntMicroVolts()

Arnd edited this page Jun 22, 2018 · 4 revisions

getShuntMicroVolts(waitSwitch,[deviceNumber]);

‼️ This library is now deprecated and has been replaced by the INA library. All existing INA226 functionality and functions have been implemented ‼️

This function returns the shunt voltage of the deviceNumber parameter in units of microvolts, default to device 0 if the parameter is not specified. The INA226 has an internal accuracy of 2.5 μV for shunt measurements giving a range from +81.92 to -81.91. The shunt voltage is returned as a unsigned 16-bit integer. The waitSwitch boolean parameter will wait for any active conversions to complete before returning the new value, otherwise it will get the current value of the registers. If the system mode is set to triggered measurements rather than continuous ones (see setMode() for details) then the next measurement is triggered by this read.

This value is directly read from the INA226 registers and is not affected by the settings for calibration given in the [begin()](https://github.com/SV-Zanshin/INA226/wiki/begin() function call.


Example:

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
} // of setup
void loop() {
  uint16_t ShuntMicrovolts = INA226.getShuntMicroVolts(TRUE);
  Serial.print("Shunt voltage is ");
  Serial.print((float)ShuntMicrovolts/1000,3); // use floating to show
  Serial.print(" mV\n");
  delay(5000); // wait 5 seconds before next measurement        
} // of main loop
Clone this wiki locally