The forth example, Example4_Differential.ino, shows how to read the ADC in differential mode using channels
A0 and A1. For this example, I am using two trimpots (tied to GND and 3.3V) to supply voltage sources to A0 and
A1. I have the A0 trimpot set to 2.5V, and it will stay there as a reference. In the readout below, I am rotating the
A1 trimpot from 0V all the way up to 3.3V. You can see that I actually start at a negative value, because my
rotating trimpot is actually sitting at 0V (or negative 2.5 Volts in relation to the other input).
Example 5: Alert
Note: This example is requires soldering. A wire must be soldered to the ALERT pin and connected to a
digital pin on your microcontroller. As written, the example assumes you are using a Arduino UNO based
board, like our RedBoard. The sketch designates Pin 2 as the read pin.
The code for Example5_Alert.ino sets up a single ended comparator in the ADS1015 chip. It is watching A3, and
it if it sees a value about the threshold of 1000 (about 3V), it will drop the ALERT pin. The serial monitor below
shows state of the alert pin (as read from D2) and the value from the ADC. This shows that when you cross 1000,
then the alert pin changes accordingly.
Example 6: Display MilliVolts
Serial Monitor readout for Example 4.
Serial Monitor readout for Example 5.
Need help?
Do you have a question about the Qwiic 12-Bit ADC and is the answer not in the manual?
Questions and answers