EasyManuals Logo

Adafruit ESP32-S3 User Manual

Adafruit ESP32-S3
263 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #137 background imageLoading...
Page #137 background image
while True:
print(get_voltage(analog_pin))
time.sleep(0.1)
Now, rotate the potentiometer to see the values change.
Now the values range from around 0 to 3.1! Note that due to variations in each chip,
you may not get all the way to 0 or 3.1, and in some cases, you may exceed 3.1. Both
of these possibilities are normal.
The example code begins with the same imports and pin setup.
This time, you include the get_voltage helper. This function requires that you
provide an analog pin. It then maps the raw analog values, 0 to 3.1 , to the voltage
values, 0 to 3.1 . It does the math so you don't have to!
Finally, inside the loop, you provide the function with your analog_pin , and print the
resulting values.
That's all there is to reading analog voltage values using CircuitPython!
NeoPixel LED
Your board has a built-in RGB NeoPixel status LED. You can use CircuitPython code to
control the color and brightness of this LED. It is also used to indicate the bootloader
status and errors in your CircuitPython code.
©Adafruit Industries Page 137 of 263

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Adafruit ESP32-S3 and is the answer not in the manual?

Adafruit ESP32-S3 Specifications

General IconGeneral
BrandAdafruit
ModelESP32-S3
CategoryMicrocontrollers
LanguageEnglish

Related product manuals