Added HD44780 compatible LCD to display arbitrary text and the current time.
This commit is contained in:
parent
b1ae6e456d
commit
87a84dc476
15
constants.h
15
constants.h
@ -12,17 +12,24 @@
|
||||
#include <FastLED.h>
|
||||
|
||||
// IO Pin Assignments
|
||||
const uint8_t pinLeds = 3;
|
||||
const uint8_t pinButton = 5;
|
||||
// moved PINs out of the way of LCD
|
||||
const uint8_t pinLeds = 6;
|
||||
const uint8_t pinButton = 7;
|
||||
const uint8_t pinBrightness = 0;
|
||||
|
||||
// Define MAC Address
|
||||
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
|
||||
char* ntp_server = "warpfire.warpzone";
|
||||
char* ntp_server = "de.ntp.pool.org";
|
||||
|
||||
// Number of LEDs in ring
|
||||
const int ledRingSize = 60;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <Ethernet.h>
|
||||
#include <Dns.h>
|
||||
#include <Dhcp.h>
|
||||
#include <LiquidCrystal.h>
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
@ -36,6 +37,13 @@ void setup() {
|
||||
// Begin serial port
|
||||
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
|
||||
if (Ethernet.begin (mac) == 0) {
|
||||
Serial.println ("Failed to configure Ethernet using DHCP");
|
||||
@ -132,6 +140,7 @@ void loop() {
|
||||
// Show clock
|
||||
clearLeds();
|
||||
showClock();
|
||||
printLCDtime();
|
||||
|
||||
// Check/Renew DHCP
|
||||
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
|
||||
void printDebugMessage() {
|
||||
Serial.print("Current date/time: ");
|
||||
|
Loading…
Reference in New Issue
Block a user