4561 views|17 replies

1w

Posts

25

Resources
The OP
 

【RPi PICO】Use SPI to drive WS2812 [Copy link]

 
 

In addition to using PIO, you can also use SPI to drive WS2812. The usage is as follows:

First copy the following program to the development board:

游客,如果您要查看本帖隐藏内容请回复

Then, you can drive WS2812. The usage is similar to that on ESP32.


from machine import SPI, Pin
from neopixel import NeoPixel
 
spi_sck=Pin(2)
spi_tx=Pin(3)
spi_rx=Pin(4)
 
spi = SPI(0, sck=spi_sck, mosi=spi_tx, miso=spi_rx)
 
np = NeoPixel(spi, 8)
for i in range(8):
    np = (0,i*4,  0)
np.show()

Latest reply

Learn from the masters! Learn from the masters! Learn from the masters! Learn from the masters!   Details Published on 2024-3-19 23:28
 
 

47

Posts

2

Resources
2
 
study
 
 
 

662

Posts

0

Resources
3
 

Thanks for sharing

 
 
 

95

Posts

4

Resources
4
 

guolaixuexi

 
 
 

1

Posts

0

Resources
5
 

Newcomer Report

 
 
 

1455

Posts

1

Resources
6
 

look

 
 
 

29

Posts

0

Resources
7
 

Thanks for sharing, I will learn from you

 
 
 

62

Posts

0

Resources
8
 

Just bought PICO, let's study PYTHON

 
 
 

62

Posts

0

Resources
9
 

I just bought a board and I don't know how to use it. How do I copy the file to the board? What is the file name? I'm new to python. Please give me some guidance. I can't even light up 1602 today. How can I install the library on the board without guidance?

Comments

Refer to the previous post: https://bbs.eeworld.com.cn/thread-1156336-1-1.html  Details Published on 2021-5-11 23:22
 
 
 

1w

Posts

25

Resources
10
 
zxy2266 posted on 2021-5-11 22:50 I just bought a board and I don’t know how to use it. How do I copy the file to the board? What is the file name? I’m a novice, don’t laugh at me. I’m new to python, please give me more guidance, ...

Refer to previous posts:

https://bbs.eeworld.com.cn/thread-1156336-1-1.html

 
 
 

5

Posts

0

Resources
11
 

Thanks for sharing

 
 
 

5

Posts

0

Resources
12
 

WS2812.py: undefined name 'buf_bytes'
WS2812.py: undefined name 'buf_bytes'
WS2812.py: undefined name 'buf_bytes'
WS2812.py: undefined name 'buf_bytes'

This paragraph will report an error

Comments

Need to post it in full  Details Published on 2021-8-27 08:37
 
 
 

5

Posts

0

Resources
13
 
  • np = NeoPixel(spi, 8)
  • for i in range(8):
    • np = (0,i*4, 0)
  • np.show()
  • -------------------
  • There is also a syntax error here. After executing np = (0,i*4, 0), np no longer inherits the NeoPixel class and the show method cannot be called.

Comments

The usage of np = (0,i*4, 0) is wrong. You can use for i in range(8): np = (10,0,0)  Details Published on 2021-8-27 08:37
 
 
 

1w

Posts

25

Resources
14
 
Sports Hall published on 2021-8-26 17:38 np = NeoPixel(spi, 8) for i in range(8): np = (0,i*4, 0) np.show() ----------- ...

np = (0,i*4, 0)

This usage is incorrect. You can use

for i in range(8):

np = (10,0,0)

 
 
 

1w

Posts

25

Resources
15
 
Sports Hall published on 2021-8-26 14:48 WS2812.py: undefined name 'buf_bytes' WS2812.py: undefined name 'buf_bytes' WS2812 ...

Need to post it in full

 
 
 

1

Posts

0

Resources
16
 

Thanks for sharing

 
 
 

2

Posts

0

Resources
17
 

study!

 
 
 

2

Posts

0

Resources
18
 

Learn from the masters! Learn from the masters! Learn from the masters! Learn from the masters!

 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

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