WeMos (5) TM1637 7段4桁LED表示

7段4桁LED を表示してみる

参考のURLの通り、試しただけ。

Contents

TM1637 用ライブラリをインストール

  1. ライブラリをダウンロード
    https://github.com/avishorp/TM1637
  2. ライブラリを Arduino IDE にインストール
  3. Arduino IDE の [スケッチ] → [ライブラリを使用] → [ライブラリをインストール…] からダウンロードしたライブラリ ZIP を選択しインストールする。

繋がる

const int CLK = D6; //Set the CLK pin connection to the display
const int DIO = D5; //Set the DIO pin connection to the display

スケッチを作成する

#include <TM1637Display.h>
 
const int CLK = D6; //Set the CLK pin connection to the display
const int DIO = D5; //Set the DIO pin connection to the display
 
int numCounter = 0;
 
TM1637Display display(CLK, DIO); //set up the 4-Digit Display.
 
void setup()
{
 display.setBrightness(0x0a); //set the diplay to maximum brightness
}
 
 
void loop()
{
 for(numCounter = 0; numCounter < 1000; numCounter++) //Iterate numCounter
 {
 display.showNumberDec(numCounter); //Display the numCounter value;
 delay(1000);
 }
}

動作を確認する

  1. Arduino IDE にてコンパイル&書き込み
  2. 時間をカウントすることが確認できる

 

参考

  • http://www.esp8266learning.com/tm1637-7-segment-display-example.php#codesyntax_3