How to drive the LEDs on the AirLift ESP32.

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
blakebr
 
Posts: 957
Joined: Tue Apr 17, 2012 6:23 pm

How to drive the LEDs on the AirLift ESP32.

Post by blakebr »

Hello,

Problem: Not all AirLift examples display statuses' with the individual GRB LEDs on the AirLift.

Question: How to access those LEDs when other CircuitPython code does not to show statuses'.

Solution:

Code: Select all

import adafruit_rgbled
from   adafruit_esp32spi import PWMOut

GREEN_LED = PWMOut.PWMOut(esp, 25) # Top
RED_LED   = PWMOut.PWMOut(esp, 26) # Mid
BLUE_LED  = PWMOut.PWMOut(esp, 27) # Bottom
status_light = adafruit_rgbled.RGBLED(GREEN_LED, RED_LED, BLUE_LED)
G1, R1, B1 = 0, 0, 0
status_light.color = (G1, R1, B1) # Turn all LEDs OFF

print("Up")
for x in range(255):
    status_light.color = (x, x, x)
    time.sleep(0.001)
print("Down")
for x in range(255, 0, -1):
    status_light.color = (x, x, x)
    time.sleep(0.001)
print("End")
Bruce

User avatar
danhalbert
 
Posts: 4654
Joined: Tue Aug 08, 2017 12:37 pm

Re: How to drive the LEDs on the AirLift ESP32.

Post by danhalbert »

Thanks for the suggestion!

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”