Arduino program
/***************
* Digital clock Wemos + TM 1637 + DS 1307
* TM1637 dan Arduino Wemos
* youtube channel : Belajar tehnologi jaman now
Koneksi antar Pin :
Wemos TM1637
D5 ------> CLK
D6 ------> DIO
VCC/3V3 ------> VCC
GND ------> GND
Wemos RTC1307
D1 ------> SCL
D2 ------> SDA
VCC/3V3 ------> VCC
GND ------> GND
***************/
//Library modul TM1637
#include <TM1637Display.h>
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 rtc;
//koneksi pin CLK ke pin D5 Arduino
//koneksi pin DIO ke pin D6 Arduino
#define CLK D5
#define DIO D6
TM1637Display display(CLK, DIO);
void setup()
{
rtc.begin();
display.clear();
display.setBrightness(0x05);
//setting jam pertama kali
// rtc.adjust(DateTime(2022, 3, 6, 22, 26, 0));
}
void loop()
{
DateTime now = rtc.now();
int jam=now.hour();
int menit=now.minute();
display.showNumberDecEx(menit,0,true,2,2);
display.showNumberDecEx(jam,0x40,true,2,0);
delay(500);
display.showNumberDecEx(jam,0,true,2,0);
delay(500);
}
* library TM1637 :
https://github.com/avishorp/TM1637/
Video Youtube Channel :
https://www.youtube.com/channel/UCy9PYJmJXElN9LaHZw_PuTA
No comments:
Post a Comment