EasyManuals Logo

SunFounder ESP32 User Manual

Default Icon
771 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 #340 background image
SunFounder ESP32 Starter Kit
Code
Note:
Open the 2.7_rgb_strip.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
from neopixel import NeoPixel
pin = Pin(14, Pin.OUT) # set a pin to output to drive NeoPixels
pixels = NeoPixel(pin, 8) # create NeoPixel driver on pin for 8 pixels
pixels[0] = [64,154,227] # set the pixel
pixels[1] = [128,0,128]
pixels[2] = [50,150,50]
pixels[3] = [255,30,30]
pixels[4] = [0,128,255]
pixels[5] = [99,199,0]
pixels[6] = [128,128,128]
pixels[7] = [255,100,0]
pixels.write() # write data to all pixels
Lets select some favorite colors and display them on the RGB LED Strip!
How it works?
1. In the neopixel module, we have integrated related functions into the NeoPixel class.
334 Chapter 3. For MicroPython User

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the SunFounder ESP32 and is the answer not in the manual?

SunFounder ESP32 Specifications

General IconGeneral
BrandSunFounder
ModelESP32
CategoryController
LanguageEnglish