Compare commits

...

1 Commits

2 changed files with 38 additions and 5 deletions

View File

@ -12,17 +12,24 @@
#include <FastLED.h> #include <FastLED.h>
// IO Pin Assignments // IO Pin Assignments
const uint8_t pinLeds = 3; // moved PINs out of the way of LCD
const uint8_t pinButton = 5; const uint8_t pinLeds = 6;
const uint8_t pinButton = 7;
const uint8_t pinBrightness = 0; const uint8_t pinBrightness = 0;
// Define MAC Address // Define MAC Address
byte mac[] = { byte mac[] = {
0xA8, 0x61, 0x0A, 0x10, 0x24, 0x01 0xA8, 0x61, 0x0A, 0x10, 0x24, 0x02
}; };
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
// these differ from the libary / example sketch default to avoid Ethernet shield pins
const int rs = 10, en = 9, d4 = 5, d5 = 8, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
// NTP Server to use // NTP Server to use
char* ntp_server = "warpfire.warpzone"; char* ntp_server = "de.ntp.pool.org";
// Number of LEDs in ring // Number of LEDs in ring
const int ledRingSize = 60; const int ledRingSize = 60;

View File

@ -15,6 +15,7 @@
#include <Ethernet.h> #include <Ethernet.h>
#include <Dns.h> #include <Dns.h>
#include <Dhcp.h> #include <Dhcp.h>
#include <LiquidCrystal.h>
#include "constants.h" #include "constants.h"
@ -36,6 +37,13 @@ void setup() {
// Begin serial port // Begin serial port
Serial.begin(serialPortBaudRate); Serial.begin(serialPortBaudRate);
// set up the LCD's number of columns and rows:
lcd.begin(20, 4);
// Print a message to the LCD.
lcd.print("Analoge LED Uhr");
lcd.setCursor(4, 3);
lcd.print("by Commander1024");
// Initialize Network and NTP // Initialize Network and NTP
if (Ethernet.begin (mac) == 0) { if (Ethernet.begin (mac) == 0) {
Serial.println ("Failed to configure Ethernet using DHCP"); Serial.println ("Failed to configure Ethernet using DHCP");
@ -132,7 +140,8 @@ void loop() {
// Show clock // Show clock
clearLeds(); clearLeds();
showClock(); showClock();
printLCDtime();
// Check/Renew DHCP // Check/Renew DHCP
Ethernet.maintain (); Ethernet.maintain ();
} }
@ -156,6 +165,23 @@ void showClock() {
} }
} }
void printLCDtime() {
lcd.setCursor(0, 1);
lcd.print("Zeit: ");
lcd.setCursor(0, 2);
lcd.print(year(now()), DEC);
lcd.print(".");
lcd.print(month(now()), DEC);
lcd.print(".");
lcd.print(day(now()), DEC);
lcd.print(" ");
lcd.print(hour(now()), DEC);
lcd.print(":");
lcd.print(minute(now()), DEC);
lcd.print(":");
lcd.print(second(now()), DEC);
}
// Print debugging info over serial // Print debugging info over serial
void printDebugMessage() { void printDebugMessage() {
Serial.print("Current date/time: "); Serial.print("Current date/time: ");