Permalink
Switch branches/tags
Nothing to show
Find file Copy path
0391fde Apr 23, 2017
1 contributor

Users who have contributed to this file

52 lines (44 sloc) 1.37 KB
// base sketch from https://brainy-bits.com/tutorials/4-bits-7-segment-led-display-with-arduino/
// changed TM1637 library by niq_ro for degree, r & h letter
// DS3231 clock on TM1637 LED display by niq_ro from http://www.tehnic.go.ro
// & http://arduinotehniq.com/
#include "TM1637.h"
//{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
//0~9,A,b,C,d,E,F,"-"," ",degree,r,h
#define CLK 9//Pins for TM1637
#define DIO 8
TM1637 tm1637(CLK,DIO);
// Date and time functions using a DS3231 RTC connected via I2C and Wire lib
#include <Wire.h>
#include "RTClib.h"
RTC_DS3231 rtc;
int hh, mm;
void setup()
{
tm1637.init();
tm1637.set(5);
//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
rtc.begin();
// manual adjust
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
// automatic adjust
//rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}//end "setup()"
void loop(){
DateTime now = rtc.now();
hh = now.hour(), DEC;
mm = now.minute(), DEC;
tm1637.point(POINT_OFF);
tm1637.display(0,hh/10); // hour
tm1637.display(1,hh%10);
tm1637.display(2,mm/10); // minutes
tm1637.display(3,mm%10); //
delay(500);
tm1637.point(POINT_ON);
tm1637.display(0,hh/10); // hour
tm1637.display(1,hh%10);
tm1637.display(2,mm/10); // minutes
tm1637.display(3,mm%10); //
delay(500);
}// end loop()