Build Seven Segment LED clock with Arduino

Project Video
Project Details

This code is for video instruction on how to build Seven Segment LED clock using DS3231 Real Time Clock and Arduino. Robojax Library Makes it very easy to build clock in a few lines.

Project Code

 * Seven Segment LED Clock with Arduino and DS3231
 * with Robojax Library
 * Written by Ahmad Shamshiri 
 * on July 26, 2018 at 21:29 in Ajax, Ontario, Canada

watch video instruction for this code:
Watch video instruction for DS3231:
Get this code and other Arduono codes from
If you found this tutorial helpful, please support me so I can continue creating 
content like this. You can support me on Patreon
or make donation using PayPal

  * 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 .
DS3231 clock;
RTCDateTime dt;

const int digits[]={9,10,11,12};// define digits pins
const int displayPins[] = {2,3,4,5,6,7,8}; // define segment pins
const int colonPin = 13;// colon pin
const int type =1;//1 common Anode, 2 for commond cathode
Robojax_SevenSegmentClock clk(displayPins,digits,colonPin,type);

int blinkTime=0;// do not change. Used internally
int blinkStatus=0;// do not change. Used internally

void setup() {

  // Initialize DS3231
  Serial.println("Initialize DS3231");
  clock.begin();//for DS3231 
  clk.begin();//for Robojax_SevenSegmentClock
  Serial.println("Robojax Seven Segment Display Clock");
  Serial.println("V 1.0 July 28, 2019"); 
  // Robojax Seven Segment Clock for Arduino
  // uncomment the line below only ONCE to updat the time. Then comment it back
  //clock.setDateTime(__DATE__, __TIME__);
}// setup ends here

void loop() {
  // Robojax Seven Segment LED Clock with Arduino
   dt = clock.getDateTime();
//  Serial.print(dt.hour);   Serial.print(":");
//  Serial.print(dt.minute); Serial.print(":");
//  Serial.print(dt.second); Serial.println("");   


}// loop ends here

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