ピックワールド(PIC World)

インフォメーション

この記事は 2013年05月18日 に以下のカテゴリに投稿されました Arduino Blog.

この記事のタグ

, , , , , , , , ,


LED マトリクスを作っちゃう – 複数枚接続してスクロールできるように!

余り時間がとれないのですけれど、コツコツと進めています。

先日は、Max7219 を使って、1枚の 8×8 LED マトリクスを制御する所まででしたが、やっぱり複数枚接続しないと、楽しくない!ってことで、ちょっとやってみましたよ。

注意点は void setup(){ ~~ } で下記をやらなきゃいけないみたい。

void setup() {
 /*
 The MAX72XX is in power-saving mode on startup,
 we have to do a wakeup call
 */
 //we have already set the number of devices when we created the LedControl
 int devices=lc.getDeviceCount();
 //we have to init all devices in a loop

 

for(int address=0;address<devices;address++) {
 /*The MAX72XX is in power-saving mode on startup*/
 lc.shutdown(address,false);
 /* Set the brightness to a medium values */
 lc.setIntensity(address,8);
 /* and clear the display */
 lc.clearDisplay(address);
 }
}

devices に接続されている Max7219 の数を得て、それぞれセットアップする。まぁ当然と言えば当然なのですけど。

で、void loop(){ ~~ }で実行しているのは、

void loop() {

for (;;){
for (int bd=0;bd<=1;bd++){
for (int col=7;col>=0;col-- ){
lc.setColumn(bd,col,B11111111);
delay(delaytime);
lc.setColumn(bd,col,B00000000);
}
}
}
}

これだけですな。

こんな感じでスクロールします。


コメントを残す

最近の投稿

最近のコメント

アーカイブ