Other Arduino Codes and Videos by Robojax

How to use 2 Digit LED display with Arduino using 74HC595

دروس آردوینو به فارسی

74HC595 Seven Segment 2 Digits LED Display with decimal points for Arduino

This this video shows how to use 2 digit LED Seven Segment Display based on 74HC595 using Arduino IDE

it will display the decimal points easily with any digits. Wait is over.

Once you downloaded and installed the library, go to File->Examples->Robojax-2DigitSevenSegment to opend the example

2 Digit LED Display setup

3 Digitsl LED Seven Segment Dispaly: Display showing

74HC595 LED Display: Display showing
Click on image to enlarge

3 Digitsl LED Seven Segment Dispaly: Code Module

74HC595 LED Display: Code Module
Click on image to enlarge

3 Digitsl LED Seven Segment Dispaly: Back of the module

74HC595 LED Display: back of the module
Click on image to enlarge

3 Digitsl LED Seven Segment Dispaly: Display showing

74HC595 LED Display: Display showing
Click on image to enlarge

3 Digitsl LED Seven Segment Dispaly: Wiring is explained

74HC595 LED Display: Wiring is explained
Click on image to enlarge

3 Digitsl LED Seven Segment Dispaly: Seven Segment explained

74HC595 LED Display: Seven Segment explained
Click on image to enlarge

3 Digitsl LED Seven Segment Dispaly: Decimal point displayed

74HC595 LED Display: Decimal point displayed
Click on image to enlarge

74HC595 Seven Segment 2 Digits LED Display with decimal points for Arduino


 /* 
*  74HC595 Seven Segment 2 Digits LED Display with decimal points for Arduino
 *  updated by Ahmad Shamshiri for Robojax 
 *  On Monday Sep 17, 2019 at 00:03 in Ajax, Ontario, Canada
 *  
 *  Watch video instruction for this video: https://youtu.be/k-f6lwwUTAs
 *  At the moments, it doesn't display decimal points. It needs a little work to make it work

You can get the wiring diagram from my Arduino Course at Udemy.com
Learn Arduino step by step with all library, codes, wiring diagram all in one place
visit my course now http://robojax.com/L/?id=62

If you found this tutorial helpful, please support me so I can continue creating 
content like this. You can support me on Patreon http://robojax.com/L/?id=63
or make donation using PayPal http://robojax.com/L/?id=64

 * Code is available at http://robojax.com/learn/arduino

 * 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/>. 


 *  Original source and text.
 *  2 Digitl 7 segment display PCB board with (2) 74HC595 shift register ICs
 *  Arduino Tutorial - www.Ardumotive.com
 *  Dev: Michalis Vasilakis // Date: 31/1/2018 // Ver:1.0
 */
#include <ShiftRegister74HC595.h>
#define SDI 7
#define SCLK 6
#define LOAD 5
#define DIGITS 2
// create shift register object (number of shift registers, data pin, clock pin, latch pin)
ShiftRegister74HC595 sr (DIGITS, SDI, SCLK, LOAD); 


int value,digit1,digit2,digit3,digit4; 
uint8_t  digits[] = {B11000000, //0
                      B11111001, //1 
                      B10100100, //2
                      B10110000, //3 
                      B10011001, //4
                      B10010010, //5
                      B10000010, //6 
                      B11111000, //7
                      B10000000, //8
                      B10010000 //9
                     };
                        
void setup() {


  
}

void loop() {
  showNumber(18);
  delay(2000);//
  for(int i=0; i<=99; i++)
  {
    showNumber(i);
    delay(100);
  }
  delay(2000);
  for(int i=99; i >=0; i--)
  {
    showNumber(i);
    delay(50);
  }
   delay(2000);   
}// loop





/*
 * @brief shows number on the Seven Segment Display
 * @param "num" is integer
 * @return returns none
 * Usage to show 18: showNumber(18);
 * Written by Ahmad Shamshiri on Sep 17, 2019. 
 * in Ajax, Ontario, Canada
 * www.Robojax.com 
 */
void showNumber(int num)
{
    digit2=num % 10 ;
    digit1=(num / 10) % 10 ;
    //Send them to 7 segment displays
    uint8_t numberToPrint[]= {digits[digit2],digits[digit1]};
    sr.setAll(numberToPrint);  
}
   

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