c. Panel P10 RGB
d. Program Arduino IDE
#include <Wire.h>
#include <DS3231.h>
#include <Adafruit_GFX.h>
#include <RGBmatrixPanel.h>
DS3231 rtc(SDA, SCL);
Time t;
#define F2(progmem_ptr) (const __FlashStringHelper *)progmem_ptr
#define CLK 8 // MUST be on PORTB! (Use pin 11 on Mega)
#define LAT A3
#define OE 9
#define A A0
#define B A1
#define C A2
RGBmatrixPanel matrix(A, B, C, CLK, LAT, OE, false);
String jam,menit,detik;
void setup()
{
matrix.begin();
matrix.setTextWrap(false); // Allow text to run off right edge
matrix.setTextSize(1);
matrix.fillScreen(0);
rtc.begin();
//rtc.setDOW(THURSDAY); // Set Day-of-Week to SUNDAY
//rtc.setTime(15, 53, 0); // Set the time to 12:00:00 (24hr format)
//rtc.setDate(13, 5, 2022); // Set the date to January 1st, 2014
}
void loop()
{
t = rtc.getTime();
jam = t.hour;
menit = t.min;
detik = t.sec;
matrix.setTextColor(matrix.Color444(1, 0, 0));
matrix.setCursor(1, 8); //x,y
matrix.print(jam);
matrix.setTextColor(matrix.Color444(3, 1, 0));
matrix.print(":");
matrix.setTextColor(matrix.Color444(0, 1, 0));
matrix.print(menit);
matrix.setCursor(10, 1); //x,y
matrix.setTextColor(matrix.Color444(0, 0, 1));
matrix.print(detik);
delay(1000);
matrix.fillScreen(0);
}
e. VIDEO HASILNYA
No comments:
Post a Comment