projekte:arduino_projekte:matrix_display
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
projekte:arduino_projekte:matrix_display [2017-01-17 14:00] – angelegt gamecompiler | projekte:arduino_projekte:matrix_display [2021-03-27 09:58] (aktuell) – gelöscht gamecompiler | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== Matrix Display Uhr ====== | ||
- | {{: | ||
- | ===== Übersicht ===== | ||
- | |||
- | Ich wollte schon immer eine LED Matrix Uhr haben, daher habe ich mir nun endlich eine gebaut. | ||
- | So nebenbei, der Start der Uhr kann manchmal eine Minute dauern. | ||
- | |||
- | ===== Material ===== | ||
- | |||
- | * DS1307 RTC Uhr, Marco hat gerade einen ganzen Schwung davon (25.10.2015) | ||
- | * [[http:// | ||
- | * Arduino Pro Micro, damit alles klein bleibt | ||
- | * MAX7219 Matrix | ||
- | |||
- | ===== Librarys ===== | ||
- | |||
- | * [[https:// | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | |||
- | |||
- | ===== Pin Verbindungen ===== | ||
- | |||
- | Wichtig zu wissen, SDA muss an SDA, SCL an SCL, also nicht zu verwechseln mit dem UART (TX an RX, RX an TX) | ||
- | Die DS1307 MUSS mit 5V betrieben werden. \\ Der DS Pin (SQW) wird in meinem Fall nicht genutzt, weil der Arduino einen eigenen Quartz hat. \\ | ||
- | |||
- | ^ Arduino Pin ^ RTC Uhr pin ^ Matrix Pin ^ | ||
- | | 2 | SDA| | ||
- | | 3 | SCL| | ||
- | | 15 | ||
- | | 14 | ||
- | | 16 | ||
- | | 10 | ||
- | |||
- | ===== Die Uhr Synchronisieren ===== | ||
- | |||
- | Unter Beispiele -> DS1307RTC -> SetTime ist ein Zeitsynchronisierungsprogramm vorhanden, es muss einfach nur geflashed werden, die RTC Uhr wird dann mit der Compiler Zeit Synchronisiert (Zeit des Flashens) | ||
- | |||
- | ===== Der Code ===== | ||
- | |||
- | <file lang=" | ||
- | /* | ||
- | * MatrixDisplayClock2 | ||
- | * example code illustrating Time library with Real Time Clock and Matrix7219 display. | ||
- | | ||
- | */ | ||
- | //Matrix | ||
- | #include < | ||
- | #include < | ||
- | #include < | ||
- | int pinCS = 10; // Attach CS to this pin, DIN to MOSI and CLK to SCK (cf http:// | ||
- | int numberOfHorizontalDisplays = 4; | ||
- | int numberOfVerticalDisplays = 1; | ||
- | |||
- | Max72xxPanel matrix = Max72xxPanel(pinCS, | ||
- | |||
- | //RTC Clock | ||
- | #include < | ||
- | #include < | ||
- | #include < | ||
- | |||
- | void setup() | ||
- | setSyncProvider(RTC.get); | ||
- | |||
- | |||
- | |||
- | matrix.setIntensity(1); | ||
- | |||
- | // | ||
- | |||
- | matrix.setPosition(0, | ||
- | matrix.setPosition(1, | ||
- | matrix.setPosition(2, | ||
- | matrix.setPosition(3, | ||
- | |||
- | //Rotate matrix @ 90 degress | ||
- | //0, 90, 180, 270 | ||
- | |||
- | matrix.setRotation(0, | ||
- | matrix.setRotation(1, | ||
- | matrix.setRotation(2, | ||
- | matrix.setRotation(3, | ||
- | } | ||
- | void loop() | ||
- | { | ||
- | if (timeStatus() == timeSet) { | ||
- | //If times is set, display time | ||
- | digitalClockDisplay(); | ||
- | | ||
- | } else { | ||
- | //Time ist not set in this case, display ERR! as error message; | ||
- | matrix.fillScreen(LOW); | ||
- | matrix.setCursor(1, | ||
- | matrix.print(" | ||
- | | ||
- | delay(4000); | ||
- | } | ||
- | delay(1000); | ||
- | } | ||
- | |||
- | void digitalClockDisplay(){ | ||
- | |||
- | //Matrix | ||
- | |||
- | //Clear matrix | ||
- | matrix.fillScreen(LOW); | ||
- | | ||
- | //Hour | ||
- | | ||
- | matrix.setCursor(1, | ||
- | matrix.print(hour()); | ||
- | | ||
- | //Symbol | ||
- | matrix.setCursor(13, | ||
- | matrix.print(":" | ||
- | matrix.setCursor(14, | ||
- | matrix.print(":" | ||
- | |||
- | //minute | ||
- | matrix.setCursor(19, | ||
- | | ||
- | |||
- | if(minute() == 0) | ||
- | { | ||
- | matrix.print(" | ||
- | } | ||
- | else if(10 > minute() > 0 ) | ||
- | { | ||
- | matrix.setCursor(19, | ||
- | matrix.print(" | ||
- | matrix.setCursor(26, | ||
- | matrix.print(minute()); | ||
- | | ||
- | } | ||
- | else | ||
- | { | ||
- | matrix.print(minute()); | ||
- | } | ||
- | | ||
- | matrix.write(); | ||
- | } | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | </ |
projekte/arduino_projekte/matrix_display.1484658009.txt.gz · Zuletzt geändert: 2022-11-17 22:34 (Externe Bearbeitung)