'TM1637'에 해당되는 글 1건

  1. 2016.10.05 4 Digit Tube LED Display Module (TM1637) [D014]

4 Digit Tube LED Display Module (TM1637) [D014]



https://www.youtube.com/watch?v=ElOG2A8QVPw


* GitHubhttps://github.com/rdiot/rdiot-d014.git


* Specs

The module is a 12-foot clock with 4 points of positive digital (0.36 inches) display module driver IC TM1637, only two signal lines can make SCM four 8-segment LED.


Module features are as follows:

Display of male red for the four digital tube

Adjustable digital tube 8 gray

Level control interface for 5V or 3.3V

4 M2 screws positioning holes for easy installation


4 digital display interface module as shown below:

Control Interface: A total of four pins (GND, VCC, DIO, CLK), GND to ground, VCC is the power supply, DIO of data input and output pin, CLK is the clock signal pin;

Digital tube: 4 common anode score points with 0.36 inches LED, red highlights;

Positioning holes: 4 M2 screws positioning hole diameter is 2.2mm, the positioning of the module is easy to install, to achieve inter-module combination.



* Contents

- DataSheet : http://www.datasheet-pdf.com/pdfhtm.php?id=788613&p=10


- Connect

CLK ----- D2

DIO ----- D3

VCC ----- 5V

GND ----- GND


- Library : https://github.com/avishorp/TM1637


- Key Code : Example TM1637Test.ino

#include <Arduino.h>

#include <TM1637Display.h>


// Module connection pins (Digital Pins)

#define CLK 2

#define DIO 3


// The amount of time (in milliseconds) between tests

#define TEST_DELAY   2000


const uint8_t SEG_DONE[] = {

 SEG_B SEG_C SEG_D SEG_E SEG_G,           // d

 SEG_A SEG_B SEG_C SEG_D SEG_E SEG_F,   // O

 SEG_C SEG_E SEG_G,                           // n

 SEG_A SEG_D SEG_E SEG_F SEG_G            // E

 };


TM1637Display display(CLK, DIO);


void loop()

{

  int k;

  uint8_t data[] = { 0xff, 0xff, 0xff, 0xff };

  display.setBrightness(0x0f);


  // All segments on

  display.setSegments(data);

  delay(TEST_DELAY);


  // Selectively set different digits

  data[0] = 0b01001001;

  data[1] = display.encodeDigit(1);

  data[2] = display.encodeDigit(2);

  data[3] = display.encodeDigit(3);


  for(k = 3; k >= 0; k--) {

    display.setSegments(data, 1, k);

    delay(TEST_DELAY);

  }


  display.setSegments(data+2, 2, 2);

  delay(TEST_DELAY);


  display.setSegments(data+2, 2, 1);

  delay(TEST_DELAY);


  display.setSegments(data+1, 3, 1);

  delay(TEST_DELAY);



  // Show decimal numbers with/without leading zeros

  bool lz = false;

  for (uint8_t z = 0; z < 2; z++) {

   for(k = 0; k < 10000; k += k*4 + 7) {

   display.showNumberDec(k, lz);

   delay(TEST_DELAY);

   }

  lz = true;

  }


  // Show decimal number whose length is smaller than 4

  for(k = 0; k < 4; k++)

   data[k] = 0;

   display.setSegments(data);


   display.showNumberDec(153, false, 3, 1);

   delay(TEST_DELAY);

   display.showNumberDec(22, false, 2, 2);

   delay(TEST_DELAY);

   display.showNumberDec(0, true, 1, 3);

   delay(TEST_DELAY);

   display.showNumberDec(0, true, 1, 2);

   delay(TEST_DELAY);

   display.showNumberDec(0, true, 1, 1);

   delay(TEST_DELAY);

   display.showNumberDec(0, true, 1, 0);

   delay(TEST_DELAY);



  // Brightness Test

  for(k = 0; k < 4; k++)

    data[k] = 0xff;

    for(k = 0; k < 16; k++) {

      display.setBrightness(k);

      display.setSegments(data);

      delay(TEST_DELAY);

    }

  // Done!

  display.setSegments(SEG_DONE);

  while(1);

}

Posted by RDIoT
|