first and working ethernet
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import time
|
||||
from machine import Pin
|
||||
import rp2
|
||||
|
||||
max_lum =100
|
||||
r=0
|
||||
g=0
|
||||
b=0
|
||||
|
||||
@rp2.asm_pio(sideset_init=rp2.PIO.OUT_LOW, out_shiftdir=rp2.PIO.SHIFT_LEFT, autopull=True, pull_thresh=24)
|
||||
def ws2812():
|
||||
T1 = 2
|
||||
T2 = 5
|
||||
T3 = 3
|
||||
wrap_target()
|
||||
label("bitloop")
|
||||
out(x, 1) .side(0) [T3 - 1]
|
||||
jmp(not_x, "do_zero") .side(1) [T1 - 1]
|
||||
jmp("bitloop") .side(1) [T2 - 1]
|
||||
label("do_zero")
|
||||
nop() .side(0) [T2 - 1]
|
||||
wrap()
|
||||
|
||||
|
||||
# Create the StateMachine with the ws2812 program, outputting on Pin(4).
|
||||
sm = rp2.StateMachine(0, ws2812, freq=8_000_000, sideset_base=Pin(25))
|
||||
|
||||
# Start the StateMachine, it will wait for data on its FIFO.
|
||||
sm.active(1)
|
||||
|
||||
# Color change
|
||||
while True:
|
||||
for i in range(0,max_lum):
|
||||
r=i
|
||||
b=max_lum-i
|
||||
rgb =(g<<24) | (r<<16) | (b<<8)
|
||||
sm.put(rgb)
|
||||
time.sleep_ms(10)
|
||||
time.sleep_ms(300)
|
||||
for i in range(0,max_lum):
|
||||
g=i
|
||||
r=max_lum-i
|
||||
rgb =(g<<24) | (r<<16) | (b<<8)
|
||||
sm.put(rgb)
|
||||
time.sleep_ms(10)
|
||||
time.sleep_ms(300)
|
||||
for i in range(0,max_lum):
|
||||
b=i
|
||||
g=max_lum-i
|
||||
rgb =(g<<24) | (r<<16) | (b<<8)
|
||||
sm.put(rgb)
|
||||
time.sleep_ms(10)
|
||||
time.sleep_ms(300)
|
||||
36
Refernce Code/RP2040-ETH-WS2812B/Python/ReadmeCN.txt
Normal file
36
Refernce Code/RP2040-ETH-WS2812B/Python/ReadmeCN.txt
Normal file
@@ -0,0 +1,36 @@
|
||||
/*****************************************************************************
|
||||
* | File : Readme_CN.txt
|
||||
* | Author :
|
||||
* | Function : Help with use
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-11-22
|
||||
* | Info : 在这里提供一个中文版本的使用文档,以便你的快速使用
|
||||
******************************************************************************/
|
||||
这个文件是帮助您使用本例程。
|
||||
在这里简略的描述本工程的使用:
|
||||
|
||||
1.基本信息:
|
||||
本例程用于测试或者演示RP2040-Zero上WS2812B;
|
||||
|
||||
2.管脚连接:
|
||||
管脚连接你可以在RP2040-Zero.py查看,这里也再重述一次:
|
||||
DIN -> 16
|
||||
|
||||
3.基本使用:
|
||||
1): 按住RP2040-Zero板上的Boot按键,将RP2040-Zero通过Type-C USB线接到电脑的USB接口,然后松开按键。
|
||||
接入之后,电脑会自动识别到一个可移动盘(RPI-RP2)
|
||||
|
||||
2): 将Python目录下的uf2文件夹中rp2-pico-20210902-v1.17.uf2 文件复制到识别的可移动盘(RPI-RP2)中
|
||||
|
||||
3): 更新Thonny IDE
|
||||
sudo apt upgrade thonny
|
||||
|
||||
4): 打开Thonny IDE (点击树莓logo -> Programming -> Thonny Python IDE )
|
||||
选择Tools -> Options... -> Interpreter
|
||||
选择MicroPython(Raspberry Pi Pico 和ttyACM0端口
|
||||
|
||||
5): 在Thonny IDE中打开Python/RP2040-Zero.py文件
|
||||
然后运行当前脚本(绿色小三角)即可
|
||||
|
||||
38
Refernce Code/RP2040-ETH-WS2812B/Python/ReadmeEN.txt
Normal file
38
Refernce Code/RP2040-ETH-WS2812B/Python/ReadmeEN.txt
Normal file
@@ -0,0 +1,38 @@
|
||||
/*****************************************************************************
|
||||
* | File : Readme_EN.txt
|
||||
* | Author :
|
||||
* | Function : Help with use
|
||||
* | Info :
|
||||
*----------------
|
||||
* | This version: V1.0
|
||||
* | Date : 2021-11-22
|
||||
* | Info : Here is an English version of the documentation for your quick use.
|
||||
******************************************************************************/
|
||||
This file is to help you use this routine.
|
||||
Here is a brief description of the use of this project:
|
||||
|
||||
1. Basic information:
|
||||
This routine is used to test or demonstrate WS2812B on RP2040-Zero.
|
||||
|
||||
2. Pin connection:
|
||||
You can check the pin connection at RP2040-Zero.py, and repeat it here:
|
||||
DIN -> 16
|
||||
|
||||
3. Basic use:
|
||||
1): Press and hold the Bootsel button on the RP2040-Zero board, connect RP2040-Zero to the USB port of the
|
||||
computer through the Type-C USB cable, and then release the button.
|
||||
After connecting, the computer will automatically recognize a removable disk (RPI-RP2)
|
||||
|
||||
2): Copy the rp2-Pico-20210902-v1.17.uf2 file from the Uf2 folder in the Python directory to an identified
|
||||
removable disk (rpi-rp2)
|
||||
|
||||
3): Update Thonny IDE
|
||||
sudo apt upgrade thonny
|
||||
|
||||
4): Open Thonny IDE (Click raspberry logo -> Programming -> Thonny Python IDE )
|
||||
select Tools -> Options... -> Interpreter
|
||||
select MicroPython(Raspberry Pi Pico and ttyACM0 port
|
||||
|
||||
5): Open the Python/ rp2040-zero.py file in Thonny IDE
|
||||
Then run the current script (little green triangle)
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user