Skip to content

getShuntRaw()

Arnd edited this page Dec 12, 2020 · 2 revisions

getShuntRaw([deviceNumber]);

This function returns the INA's raw measurement for the shunt for the specified "deviceNumber" device, defaulting to device 0 when the parameter is not specified. Each INA2xx has a defined LSB for shunt accuracy, typically 2.5 μV, this would need to be applied to the raw value in order to get a valid voltage reading (use [getShuntMicroVolts()](https://github.com/Zanduino/INA/wiki/getShuntMicroVolts() to get this value). The raw value is as a signed 16-bit integer. If the system mode is set to triggered measurements rather than continuous ones (see setMode() for details) then the next measurement cycle is triggered by this read.

This value is directly read from the INA2xx registers and is not affected by the settings for calibration given in the begin() function call.


Example:

INA_Class INA(); // Instantiate the class
void setup() {
  uint8_t deviceCount = INA.begin(10,100000); // 10 Amp Maximum bus with a shunt resistor of 0.1 Ohm
  Serial.print("Found ");
  Serial.print(deviceCount); 
  Serial.print(" INA2xx devices, displaying data for device 0, a \"");
  Serial.print(INA.getDeviceName());
  Serial.println("\".");
} // of setup
void loop() {
  uint32_t ShuntRaw = INA.getShuntRaw(); // wait for conversion on device 0 to complete
  Serial.print("Shunt raw value is ");
  Serial.print(ShuntRaw);
  Serial.print("\n");
  delay(5000); // wait 5 seconds before next measurement        
} // of main loop