Advertisement
Guest User

MAX7219 plus RTC

a guest
Jan 25th, 2020
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 1.34 KB | None | 0 0
  1. // Program
  2.  
  3.  
  4. #include <MD_Parola.h>
  5. #include <MD_MAX72xx.h>
  6. #include <SPI.h>
  7. #define HARDWARE_TYPE MD_MAX72XX::FC16_HW
  8. #define MAX_DEVICES 4
  9. #define CLK_PIN   13
  10. #define DATA_PIN  11
  11. #define CS_PIN    10
  12. MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
  13.  
  14.  
  15. #include <Wire.h>
  16. #include <DS3231.h>
  17. DS3231 rtc;
  18. RTCDateTime datumCas;
  19. byte showtime;
  20.  
  21.  
  22.  
  23. void setup(void)
  24. {
  25.   Serial.begin(9600);
  26.  
  27.   P.begin();
  28.   // Set the brightness of the led, 0= minimum, 15= maximum
  29.   P.setIntensity(2);
  30.  
  31.   rtc.begin();
  32.   rtc.setDateTime(__DATE__, __TIME__);
  33. }
  34.  
  35. void loop(void)
  36. {
  37.   Serial.print("Datum a cas DS3231: ");
  38.   Serial.print(datumCas.year);   Serial.print("-");
  39.   Serial.print(datumCas.month);  Serial.print("-");
  40.   Serial.print(datumCas.day);    Serial.print(" ");
  41.   Serial.print(datumCas.hour);   Serial.print(":");
  42.   Serial.print(datumCas.minute); Serial.print(":");
  43.   Serial.print(datumCas.second); Serial.println("");
  44.  
  45.  
  46.   //-----------------------------------------------------------
  47.   //P.print(datumCas.hour && datumCas.minute && datumCas.second);
  48.   delay(1000);
  49.   datumCas = rtc.getDateTime();
  50.   showtime = datumCas.second ;
  51.   P.print(showtime);
  52.   Serial.print("Kopie displeje na serial: ");
  53.   Serial.print(showtime); Serial.println("");
  54.   //-----------------------------------------------------------
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement