Back to Step by Step Course by Robojax

Lesson 20: Using TM1637 4 digit display

If you don't like to see ads while video is being played you can purchase YouTube premium Here

Lesson 20: Using TM1637 4 digit display

Please select other codes for this lecture from the links below.

Related or required files and link to this lesson

Part 2: LCD, LED and OLED Screens

In this lecture we learn how to use TM1637 four digit seven segment display to display integer and hexadecimal vlaues. Decimal point can't be dispalyed easily.
A counter example which counts from 0 is shown.


 /*
 *  Robojax Arduino Step By Step Course
 * Lesson 20-2  Introduction to TM1637 4 digits LED Display
 This is counter code.
 * 
 *  This code has been modefied from the Arduino library
 
 
   Please watch video instruction here https://youtu.be/cJqmXjERwkQ
 This code is available at http://robojax.com/course1/?vid=lecture11
 
with over 100 lectures Free On  YouTube Watch it here http://robojax.com/L/?id=338
Get the code for the course: http://robojax.com/L/?id=339 
 *  Updted by Ahmad Shamshiri for Robojax 
 *  in Ajax, Ontario, Canada
 * 
 * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.* 
 * This code has been download from Robojax.com
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
#include <Arduino.h>
#include <TM1637Display.h>

// Module connection pins (Digital Pins)
#define CLK 5
#define DIO 6

// The amount of time (in milliseconds) between tests
#define TEST_DELAY   15000

uint8_t allDigits[] = { 0xff, 0xff, 0xff, 0xff };
uint8_t blank[] = { 0x0, 0x0, 0x0, 0x0 };// blank value for all digits


TM1637Display display(CLK, DIO);

void setup()
{
 display.setBrightness(0x0f);  
}

void loop()
{
  // count up to 2000
  for(int i=0; i<=2000; i++)
  {
   display.showNumberDec(i);  
  }
  delay(3000);
  // count down from 1700 to zero
  for(int i=1700; i>=0; i--)
  {
   display.showNumberDec(i);  
  }
  delay(5000);
  display.setSegments(blank);
  display.showNumberDec(125, false, 3,1);
  delay(TEST_DELAY);
  
  display.setSegments(blank);
  display.showNumberDec(384,true);
  delay(TEST_DELAY);

  display.setSegments(blank);
  display.showNumberDec(736,false);
  delay(3000);  




  display.setSegments(blank);
  display.showNumberDec(153, false, 3, 1);
  delay(TEST_DELAY);

  display.setSegments(blank);  
  display.showNumberDec(22, false, 2, 2);
  delay(TEST_DELAY);

  display.setSegments(blank);  
  display.showNumberDec(0, true, 1, 3);
  delay(6000);

  display.setSegments(blank);  
  display.showNumberDec(0, true, 1, 2);
  delay(3000);

  display.setSegments(blank);  
  display.showNumberDec(0, true, 1, 1);
  delay(3000);

  display.setSegments(blank);  
  display.showNumberDec(0, true, 1, 0);
  delay(3000);


  while(1);
}






   

The least I expect from you is to thumb up the video and subscribe to my channel. I appriciate that. .I have spent months making these lectures and writing code. You don't lose anything by subscribging to my channel. Your subscription is stamp of approval to my videos and more people can find them and in it turn it helps me. Thank you

If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal

**** AFFILIATE PROGRAM **** We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.

Right Side
footer