EasyManua.ls Logo

SunFounder ESP32 - Page 432

Default Icon
771 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SunFounder ESP32 Starter Kit
Code
Note:
Open the 6.5_color_gradient.py file located in the esp32-starter-kit-main\micropython\codes
path, or copy and paste the code into Thonny. Then, click “Run Current Script” or press F5 to execute it.
Make sure to select the “MicroPython (ESP32).COMxx” interpreter in the bottom right corner.
from machine import Pin, ADC, PWM
import neopixel
import time
NUM_LEDS = 8 # Number of LEDs in the strip
PIN_NUM = 26 # LED strip
POT_PIN = 14 # Potentiometer
# Initialize the potentiometer
potentiometer = ADC(Pin(POT_PIN))
(continues on next page)
426 Chapter 3. For MicroPython User

Table of Contents