#211 7Segment LED I2C Brick
Overview
7セグメントLEDを使ったBrickです。
I2Cで表示パターンを制御できます。
接続
I2Cコネクタへ接続します。
Arduino
Raspberry Pi
TLC59208F Datasheet
Register
A0 |
A1 |
A2 |
Slave Address |
LOW |
LOW |
LOW |
0x20 |
FaBo Brickでは、初期値に0x20が設定されています。Brick裏面のソルダージャンパーで設定を変更できます。
回路図
Library
| sudo pip install FaBo7Seg_TLC59208
|
Sample Code
PWM出力値は、"0x02"でほぼ視認できる明るさで点灯されます。あまり高い数値にすると、点灯しなくなるおそれがあります。
Sample Code1
I2Cコネクタに7seg Brickを接続し、「0〜9」を順番に表示させます。
1
2
3
4
5
6
7
8
9
10
11
12
13
14 | # coding: utf-8
import FaBo7Seg_TLC59208
import time
tlc59208 = FaBo7Seg_TLC59208.TLC59208()
try:
while True:
for i in xrange(10):
tlc59208.showNumber(i)
time.sleep(0.5)
except KeyboardInterrupt:
tlc59208.showNumber(10)
|
Sample Code2
それぞれの部位を光らせます。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 | # coding: utf-8
import FaBo7Seg_TLC59208
import time
tlc59208 = FaBo7Seg_TLC59208.TLC59208()
try:
while True:
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_PIN_A | FaBo7Seg_TLC59208.LED_PIN_G | FaBo7Seg_TLC59208.LED_PIN_D);
time.sleep(1)
for i in xrange(10):
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_PWM5)
time.sleep(0.05)
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_PWM4)
time.sleep(0.05)
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_PWM2)
time.sleep(0.05)
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_PWM1)
time.sleep(0.05)
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_PWM0)
time.sleep(0.05)
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_PWM6)
time.sleep(0.05)
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_PWM5)
time.sleep(0.05)
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_PWM4)
time.sleep(0.05)
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_PWM2)
time.sleep(0.05)
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_PWM1)
time.sleep(0.05)
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_PWM0)
time.sleep(0.05)
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_PWM6)
time.sleep(0.05)
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_PWM5)
time.sleep(0.05)
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_OFF)
time.sleep(0.05)
tlc59208.showNumber(i)
time.sleep(1)
tlc59208.showDot()
time.sleep(1)
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_OFF)
time.sleep(1)
except KeyboardInterrupt:
tlc59208.showPattern(FaBo7Seg_TLC59208.LED_OFF)
|
構成Parts
- 7セグメントLED
- Texas Instruments TLC59208F
GitHub
- https://github.com/FaBoPlatform/FaBo/tree/master/211_7seg