from machine import Pin
from neopixel import NeoPixel
from time import *
print('hello ESP32!')
D0 = 2
led_pin = Pin(D0, Pin.OUT)
# create NeoPixel driver on GPIO0 for 2 pixels:
np = NeoPixel(led_pin, 2)
print('set the first pixel to white..')
np[0] = (255, 255, 255)
print('set the second pixel to yellow..')
np[1] = (255, 255, 0)
# write data to all pixels:
#np.write()
sleep_ms(1000)
# simulator BUG?
# doesn't go beyond this point..
print('change to red..')
np[0] = (255, 0, 0)
np.write()
sleep_ms(1000)
#for i in range(3):
# while True:
# duty_cycle_str = input('pwm duty (0 - 1023): ')
# led_pwm.duty(int(duty_cycle_str))
# sleep_ms(100)Loading
xiao-esp32-c3
xiao-esp32-c3