« Turtorial Examples for CircuitPython(Teensy4.0) | トップページ | CircuitPythonにGrove-7Seg-LEDを接続する »

2020年3月20日 (金)

CircuitPythonにMini-8x8-BackPackを接続する

2020/2/20

CircuitPython Mini-8x8-BackPack(i2c)

CircuitPython Mini-8x8-BackPack(i2c)

概要

CircuitPythonに以下のMini-8x8-BackPackを接続する。
(ホストPCとしてはubuntuを想定している)

Adafruit I2C通信の8x8ミニLEDマトリックス基板(黄色)

接続

以下のように接続する。

Wiring:

8x8_Backpacks Teensy4.0
SCL D19(SCL0)
SDA D18(SDA0)
VCC 3.3V
GND GND

該当モジュールのインストール

Module Install:

mkdir cpy_ws cd cpy_ws git clone https://github.com/adafruit/Adafruit_CircuitPython_Bundle.git cd Adafruit_CircuitPython_Bundle ./update-submodules.sh # copy related modules cd libraries cp drivers/ht16k33/adafruit_ht16k33 CIRCUTPY/lib/ cp helpers/adafruit_bus_device CIRCUTPY/lib/

動作確認(テスト・スクリプト)

LED_8x8_Backpack_test.py

# LED_8x8_Backpack_test.py # Import all board pins. import time import board import busio # Import the HT16K33 LED matrix module. from adafruit_ht16k33 import matrix # Create the I2C interface. i2c = busio.I2C(board.SCL, board.SDA) matrix = matrix.MatrixBackpack16x8(i2c) # will use for 8x8 BackPack # Dot Order # row: 70123456 (left to right) # col: 01234567 (top to bottom) def drawSmiley(): # Draw a Smiley Face matrix.fill(0) #=============== matrix[7,2] = 1 matrix[7,3] = 1 matrix[7,4] = 1 matrix[7,5] = 1 # matrix[0,1] = 1 matrix[0,6] = 1 # matrix[1,0] = 1 matrix[1,2] = 1 matrix[1,4] = 1 matrix[1,7] = 1 # matrix[2,0] = 1 matrix[2,5] = 1 matrix[2,7] = 1 #-------------- matrix[3,0] = 1 matrix[3,5] = 1 matrix[3,7] = 1 # matrix[4,0] = 1 matrix[4,2] = 1 matrix[4,4] = 1 matrix[4,7] = 1 # matrix[5,1] = 1 matrix[5,6] = 1 # matrix[6,2] = 1 matrix[6,3] = 1 matrix[6,4] = 1 matrix[6,5] = 1 #=============== matrix.fill(0) drawSmiley() time.sleep(5) # Move the Smiley Face Around for n in range(20): for frame in range(0, 8): matrix.shift_right(True) time.sleep(0.05) for frame in range(0, 8): matrix.shift_down(True) time.sleep(0.05) for frame in range(0, 8): matrix.shift_left(True) time.sleep(0.05) for frame in range(0, 8): matrix.shift_up(True) time.sleep(0.05) drawSmiley() time.sleep(5) matrix.fill(0) #-------------------------------------

8x8のLEDにSmileyが表示されたあと、スクロールすれば動作としてはOKとなる。

参照情報

Adafruit I2C通信の8x8ミニLEDマトリックス基板(黄色)

Adafruit LED 8x8 Backpacks
Assembly
CircuitPython Wiring and Setup

Turtorial Examples for CircuitPython(Teensy4.0)
Teensy4.0にCircuitPythonをインストールする

以上

|

« Turtorial Examples for CircuitPython(Teensy4.0) | トップページ | CircuitPythonにGrove-7Seg-LEDを接続する »

linux」カテゴリの記事

CircuitPython」カテゴリの記事

コメント

コメントを書く



(ウェブ上には掲載しません)




« Turtorial Examples for CircuitPython(Teensy4.0) | トップページ | CircuitPythonにGrove-7Seg-LEDを接続する »