2620 views|3 replies

1w

Posts

25

Resources
The OP
 

ESP32-S2-Saola-1 flashing light [Copy link]

 

ESP32-S2-Saola-1 does not use a traditional LED as an indicator light, but uses a WS2812. The advantage is that it takes up less IO and displays rich colors, but the disadvantage is that the timing is more complicated. For the ESP32-S2 port of circuitpython, because the current version of the firmware does not support the underlying neopixel_write function, it is impossible to use WS2812 directly, and it needs to wait for the version upgrade to use it.

For ordinary LEDs, driving them is relatively easy. However, in CircuitPython, the usage is quite different from that in MicroPython. First, you need to import digitalio, then define the digitalio.DigitalInOut instance, and define the direction of the IO as output (digitalio.Direction.OUTPUT). To set the output of the IO, you assign a value to it. The specific method is as follows (assuming that GPIO2 is used to drive the LED):

import board
import digitalio
import time
led = digitalio.DigitalInOut(board.IO2)
led.direction = digitalio.Direction.OUTPUT
for i in range(10):
    led.value = True
    time.sleep(0.2)
    led.value = False
    time.sleep(0.2)

Latest reply

Is there a big difference between MicroPython and CircuitPython?   Details Published on 2020-7-15 15:54
 
 

2w

Posts

341

Resources
2
 

Less code, concise

 
 
 

7422

Posts

2

Resources
3
 

Is there a big difference between MicroPython and CircuitPython?

Comments

Very large  Details Published on 2020-7-15 22:23
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 
 

1w

Posts

25

Resources
4
 
freebsder posted on 2020-7-15 15:54 Is there a big difference between micropython and circuitpython?

Very large

 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list