Skip to content

alertOnConversion()

Arnd edited this page Dec 12, 2020 · 7 revisions

alertOnConversion(State [, deviceNumber]);

This call is ignored for devices such as the INA219 which have no "ALERT" pin. It will Set, or UnSet, the alert pin functionality for the device given in "deviceNumber"; setting all devices which have an alert pin if the "deviceNumber" parameter is omitted.

This function accepts a boolean argument which activates changing state on the ALERT pin. 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 INA 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.


Example:

A complete example program using this call and Arduino IDE pin-change interrupts can be found in the source code and documented at BackgroundRead