Back to Arduino Step By Step Course

Lesson 24: 74HC595 Two Digit Display | Arduino Step by Step Course

If you don't like to see ads while video is being played you can purchase this course for $200 from Udemy or purchase YouTube premium Here

Please download required files for this code

Part 2: LCD, LED and OLED Screens

In this lecture we learn how to use SD1306 OLED Display to display text and shapes on the screen.

 *  updated by Ahmad Shamshiri for Robojax 
  Lesson 24: 2 digits dispaly using 74HC595 chip
 *  On Monday Sep 17, 2019 at 00:03 in Ajax, Ontario, Canada
 *  Watch video instruction for this video:
 *  At the moments, it doesn't display dicimal points. It needs a little work to make it work

 * This code is part of Arduino Step by Step Course which starts here:
 * for library of this code visit
If you found this tutorial helpful, please support me so I can continue creating 
content like this. Make a donation using PayPal by credit card 

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

 *  Original source and text.
 *  2 Digitl 7 segment display PCB board with (2) 74HC595 shift register ICs
 *  Arduino Tutorial -
 *  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() {
  for(int i=0; i<=99; i++)
  for(int i=99; i >=0; i--)
}// 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
void showNumber(int num)
    digit2=num % 10 ;
    digit1=(num / 10) % 10 ;
    //Send them to 7 segment displays
    uint8_t numberToPrint[]= {digits[digit2],digits[digit1]};


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 and affiliated sites.