Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ddda65a

Browse files
committed
1
1 parent 8c0f5ac commit ddda65a

File tree

1 file changed

+32
-107
lines changed

1 file changed

+32
-107
lines changed

readme.md

Lines changed: 32 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
# mircopython - Led
2-
#### [English document]()
3-
- 前提准备:[第一次使用必看](https://github.com/aJantes/Initialize-the-board/blob/master/readme.md)
4-
- 硬件介绍:
5-
1. [BPI:bit(ESP32)](https://github.com/aJantes/introduce-bpi-bit/blob/master/readme.md)
6-
2. [LED灯WS2812B](https://github.com/BPI-STEAM/BPI-BIT/blob/master/doc/WS2812B.pdf)
7-
- 编程工具:[pycharm](https://github.com/aJantes/use-pycharm/blob/master/readme.md)
8-
## LED矩阵上显示文字
9-
在BPI:bit(ESP32)显示想要的文字
2+
#### 📖 [English document]()
3+
> 前提准备:[第一次使用必看](https://github.com/aJantes/Initialize-the-board/blob/master/readme.md)
104
5+
> 硬件介绍:
116
12-
### 简单的显示文本
7+
- [BPI:bit(ESP32)](https://github.com/aJantes/introduce-bpi-bit/blob/master/readme.md)
8+
- [LED灯WS2812B](https://github.com/BPI-STEAM/BPI-BIT/blob/master/doc/WS2812B.pdf)
139

14-
- [show_text.py](https://github.com/aJantes/rolling_text/blob/master/show_text.py)
10+
> 编程工具:[pycharm](https://github.com/aJantes/use-pycharm/blob/master/readme.md)
1511
1612

1713

18-
### 字符颜色改变
19-
相比于microbit,bpibit的led面板采用的是可编程的RGB灯(ws2812b)
20-
这种RGB灯通过编程理论上可以显示255 *255 *255种颜色,也就是1600万种颜色
21-
22-
23-
想要改变字体的颜色是很简单的,在我们的固件中预置了8种颜色
14+
# LED矩阵显示
15+
LED矩阵 硬件相关函数 [display 模块](https://github.com/BPI-STEAM/MicroPython-Samples/blob/master/10.microbit/display.py)。在调用相关函数前,需要先导入对应的库。
16+
2417

18+
## **显示滚动文本**
19+
**bpi:bit** 的 led面板 采用的是可编程的 RGB灯(ws2812b),这种 RGB灯 通过编程理论上可以显示255 *255 *255种颜色,也就是1600万种颜色。下面是在固件中预置的8种颜色
2520
```Python
2621
black = [0, 0, 0]
2722
Red = [2, 0, 0]
@@ -32,111 +27,41 @@ Blue = [0, 0, 2]
3227
Indigo = [0, 2, 2]
3328
Purple = [2, 0, 2]
3429
```
35-
分别是黑(灯熄灭,注意大小写)、红、橙、黄、绿、蓝、靛、紫。有了这几种基本的颜色就可以来修改我们的字体颜色
36-
37-
38-
39-
### 显示黄色字体
40-
- [display_yellow_text.py](https://github.com/aJantes/rolling_text/blob/master/display_yellow_text.py)
41-
42-
43-
![yellow](rollingText_album/yellow.gif)
44-
45-
### 显示多色字体
46-
- [display_color_text.py](https://github.com/aJantes/rolling_text/blob/master/display_color_text.py)
47-
48-
![color](rollingText_album/color.gif)
49-
50-
### 自定义颜色
51-
52-
- [display_custom_color.py](https://github.com/aJantes/rolling_text/blob/master/display_custom_color.py)
53-
5430
如果想要了解更多RGB颜色, [请点击查看RGB颜色查询对照表](http://tool.oschina.net/commons?type=3)
31+
## 主要函数
5532

33+
- `display.scroll(val, color=Red, delay=150)`
5634

35+
`val` 为想要传进去的字符串; `color` 为需要显示的颜色; `delay` 为led灯滚动的时间间隔。
5736

58-
![mycolor](rollingText_album/mycolor.gif)
59-
60-
61-
### 面板显示图像
62-
63-
64-
- [show_image.py](https://github.com/aJantes/rolling_text/blob/master/show_image.py)
65-
66-
![emoj](rollingText_album/emoj.jpg)
67-
68-
### 内置的图片列表如下
69-
70-
- Image.HEART
71-
- Image.HEART_SMALL
72-
- Image.HAPPY
73-
- Image.SMILE
74-
- Image.SAD
75-
- Image.CONFUSED
76-
- Image.ANGRY
77-
- Image.ASLEEP
78-
- Image.SURPRISED
79-
- Image.SILLY
80-
- Image.FABULOUS
81-
- Image.MEH
82-
- Image.YES
83-
- Image.NO
84-
- Image.CLOCK12, Image.CLOCK11, Image.CLOCK10, Image.CLOCK9, Image.CLOCK8, Image.CLOCK7, Image.CLOCK6, Image.CLOCK5, Image.CLOCK4, Image.CLOCK3, Image.CLOCK2, Image.CLOCK1
85-
- Image.ARROW_N, Image.ARROW_NE, Image.ARROW_E, Image.ARROW_SE, Image.ARROW_S, Image.ARROW_SW, Image.ARROW_W, Image.ARROW_NW
86-
- Image.TRIANGLE
87-
- Image.TRIANGLE_LEFT
88-
- Image.CHESSBOARD
89-
- Image.DIAMOND
90-
- Image.DIAMOND_SMALL
91-
- Image.SQUARE
92-
- Image.SQUARE_SMALL
93-
- Image.RABBIT
94-
- Image.COW
95-
- Image.MUSIC_CROTCHET
96-
- Image.MUSIC_QUAVER
97-
- Image.MUSIC_QUAVERS
98-
- Image.PITCHFORK
99-
- Image.XMAS
100-
- Image.PACMAN
101-
- Image.TARGET
102-
- Image.TSHIRT
103-
- Image.ROLLERSKATE
104-
- Image.DUCK
105-
- Image.HOUSE
106-
- Image.TORTOISE
107-
- Image.BUTTERFLY
108-
- Image.STICKFIGURE
109-
- Image.GHOST
110-
- Image.SWORD
111-
- Image.GIRAFFE
112-
- Image.SKULL
113-
- Image.UMBRELLA
114-
- Image.SNAKE
115-
116-
### 创造自己的图片
37+
例如 `display.scroll("Hello World!",color=Yellow,delay=200)` 在led矩阵滚动显示黄色的"Hello World!" 字符串,滚动的时间间隔为 200 ms。
11738

118-
在每一个 LED 在物理显示上可以被设置为一个值,类似于高低电平,比如某个像素点被设置成 0 ,那么它的亮度就是 0 .然而如果它被设置成 1,那么它就是指灯的亮度为 1 。利用led的亮与灭,很容易的创造一个想要的新图片
119-
- [show_my_image.py](https://github.com/aJantes/rolling_text/blob/master/show_my_image.py)
12039

121-
![emoj2](rollingText_album/emoj2.jpg)
12240

12341

42+
## **面板显示图像**
12443

125-
### 如何制作一个简单的动画
44+
图像的显示是由于led矩阵上每个led灯的亮灭、颜色、亮度等状态不同而形成的。只要控制不同led灯的状态,就能形成想要的图像。图像是由一个列表组成,在列表中按led灯排列顺序分别赋值1(亮)或者0(暗),从而显示图像。在 [display 模块](https://github.com/BPI-STEAM/MicroPython-Samples/blob/master/10.microbit/display.py) 中已经配置好一些图片。只需要调用即可显示。
12645

127-
- [show_clock.py](https://github.com/aJantes/rolling_text/blob/master/show_clock.py)
46+
## 主要函数
47+
- `display.show(images, loop, delay)`:
12848

129-
![emoj2](rollingText_album/mycolor.gif)
49+
`images` 为需要显示的列表; `loop`通过写入 `True` 或者 `False` ,使得动画是否循环; `delay` 为led灯变化的时间间隔。
13050

131-
### 创造自己的动画
132-
- [show_animation.py](https://github.com/aJantes/rolling_text/blob/master/show_animation.py)
51+
函数按照填入的列表显示出相应的图像。
13352

134-
![running](rollingText_album/love.gif)
53+
例如 `display.show(Image.ALL_CLOCKS, loop=True, delay=100)` 在led矩阵通过led的亮灭显示出时钟。时钟循环播放,每次的变化间隔为 100 ms。
13554

13655

137-
#### 下面有几个注意点
56+
---
13857

139-
1. 每个颜色的亮度都有0-255总共256个数值可以选择,所以最小就是[0 , 0 , 0],最大就是[255 ,255 , 255]
140-
2. 亮度一般不要调得太大,亮度太亮容易晃眼睛
141-
3. 如果要使用内置的颜色就要导入 display 模块,就可以使用了内置的颜色Red,所以在一开始就通过 from display import * 导入display模块
58+
## **led矩阵例子**
59+
1. [show_text.py](https://github.com/aJantes/rolling_text/blob/master/show_text.py) 显示简单文本
60+
2. [display_yellow_text.py](https://github.com/aJantes/rolling_text/blob/master/display_yellow_text.py) 显示黄色文本
61+
3. [display_color_text.py](https://github.com/aJantes/rolling_text/blob/master/display_color_text.py) 显示多色文本
62+
4. [display_custom_color.py](https://github.com/aJantes/rolling_text/blob/master/display_custom_color.py) 显示自定义颜色文本
63+
5. [show_image.py](https://github.com/aJantes/rolling_text/blob/master/show_image.py) 显示内置图像
64+
6. [show_my_image.py](https://github.com/aJantes/rolling_text/blob/master/show_my_image.py) 显示自定义图像
65+
7. [show_clock.py](https://github.com/aJantes/rolling_text/blob/master/show_clock.py) 显示内置动画
66+
8. [show_animation.py](https://github.com/aJantes/rolling_text/blob/master/show_animation.py) 显示自定义动画
14267

0 commit comments

Comments
 (0)