-
Notifications
You must be signed in to change notification settings - Fork 9
setAlertPinOnConversion()
Set alert pin as specified below for the device given in "deviceNumber"; setting all devices if the "deviceNumber" parameter is omitted.
This function accepts a boolean argument which activates changing state on the ALERT pin (pin 3 in 10-Pin VSSOP package). The pin is open drain so should be pulled high with either an external resistor or by using the Arduino call "pinMode(,INPUT_PULLUP);". When a conversion is complete the INA226 will pull this pin down to ground. The state will remain set until either the configuration register is read or the Mask/Enable register is read. The simplest means to reset the state is to call waitForConversion() which will read the Mask/Enable register and will also return immediately without waiting, since the conversion is complete when the function is called.
A complete example program using this call and Arduino IDE pin-change interrupts can be found in the source code and documented at BackgroundRead