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

getShuntMicroVolts()

Arnd edited this page Jan 10, 2017 · 4 revisions

getShuntMicroVolts([wait]);

This function returns the shunt voltage in units of microvolts. 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 nsigned 16-bit integer. The optional boolean parameter, when set to "true", will wait for any active conversions to complete before returning the new value. 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.


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();
  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