記事一覧

Keyestudio I2C 8x8 LED Matrix HT16K33 その①

Keyestudio I2C 8x8 LED Matrix HT16K33 その①



こんにちはRoboTakaoです。ようこそ「極力ローコスト ロボット製作 ブログ」にお越しくださいました。

Yahoo!ショッピングでこちらも激安で430円で購入した8x8マトリックスLEDです。どうやらAdafruitのI2C通信8x8LEDと同じ仕様で、ArduinoのライブラリーはAsafruitのものを使用するようです。

HT16K33_8x8_01.jpg

メーカーサイトはこちら
http://wiki.keyestudio.com/index.php/Ks0064_keyestudio_I2C_8x8_LED_Matrix_HT16K33

スペック


 Input volt: 5V
 Rated input frequency: 400KHZ
 input power: 2.5W
 Input curr: 500mA

ピン配置

HT16K33_8x8_02.jpg

Arduinoとの接続

Vcc → 5V
GND → GND
SDA → A4
SCL → A5

HT16K33_8x8_03.jpg


サンプルコード

HT16K33_8x8_04.png


#include
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
#ifndef _BV
#define _BV(bit) (1<<(bit))
#endif
Adafruit_LEDBackpack matrix = Adafruit_LEDBackpack();
uint8_t counter = 0;
void setup() {
Serial.begin(9600);
Serial.println("HT16K33 test");
matrix.begin(0x70); // pass in the address
}
void loop() {
// paint one LED per row. The HT16K33 internal memory looks like
// a 8x16 bit matrix (8 rows, 16 columns)
for (uint8_t i=0; i<8; i++) {
// draw a diagonal row of pixels

matrix.displaybuffer[i] = _BV((counter+i) % 16) | _BV((counter+i+8) % 16) ;
}
// write the changes we just made to the display
matrix.writeDisplay();
delay(100);
counter++;
if (counter >= 16) counter = 0;
}


ただし次のライブラリーを入れる必要があります。
1. Adafruit_LEDBackpack.h
2. Adafruit_GFX.h

ライブラリーのインストール手順

スケッチ→ライブラリをインクルード→ライブラリを管理

HT16K33_8x8_05.png

ここで上記のライブラリー検索してインストール。

HT16K33_8x8_06.png

HT16K33_8x8_07.png

これでスケッチをコンパイルしてArduinoに転送するとサンプルスケッチが動作します。



サンプル例からMatrix8x8を選ぶとこのようになります。



データシート

http://www.keyestudio.com/files/index/download/id/1463720999/

次回はMatrix8x8のサンプルスケッと自分で作ったビットマップの描画を説明します。

それでは今回はこの辺で失礼します!ありがとうございました。

スポンサードリンク

コメント

コメントの投稿

非公開コメント

プロフィール

RoboTakao

Author:RoboTakao
みなさんご訪問ありがとうございます。ロボット作りたいけどお小遣いそんなにないし、簡単でローコストでロボットを作るための私のプロジェクトを紹介します。

ウェブサイトもありますのでそちらもよろしくお願いします。
http://robotakao.jp/

スポンサーリンク