Now that we have our ADS1115 connected to our Raspberry Pi, it's time to learn how to use it to read in analog values, specifically the analog values created by our two potentiometers. We will use these analog values shortly to produce a PWM signal, which in turn will control the brightness of our LED.
The code we are about to cover can be found in the file chapter05/analog_input_ads1115.py. Please review this file before continuing.
- Start by running the program in a Terminal:
(venv) $ python analog_input_ads1115.py
- You should receive a stream of output similar to the following (your value and volts numbers will be different):
Frequency Pot (A0) value=3 volts=0.000 Duty Cycle Pot (A1) value= 9286 volts=1.193
Frequency Pot (A0) value=3 volts=0.000 Duty Cycle Pot (A1) value= 9286 volts=1.193
...truncated...
- Turn the two potentiometers and watch the output change—specifically, you will notice the numbers reported for value and...