Last active
January 30, 2016 19:53
-
-
Save michaelsarduino/94599c74994c8598dcf1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Time.h> | |
#include <LiquidCrystal.h> | |
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); | |
void setup() { | |
Serial.begin(115200); | |
lcd.begin(20, 4); | |
lcd.print("Time:"); | |
setTime(12,12,12, 12, 12, 12); | |
delay(10000); | |
} | |
void loop() { | |
if(Serial.available() > 5) | |
{ | |
delay(100); | |
String stund = Serial.readStringUntil('|'); | |
delay(100); | |
String minut = Serial.readStringUntil('|'); | |
delay(100); | |
String sekund = Serial.readStringUntil('|'); | |
int stunde = stund.toInt(); | |
int minutee = minut.toInt(); | |
int sekunde = sekund.toInt(); | |
setTime(stunde, minutee, sekunde, 12, 12, 12); //stunde, minute, sekunde, tag, monat, jahr | |
} | |
lcd.setCursor(0, 1); | |
lcd.print(hour()); | |
lcd.setCursor(2, 1); | |
lcd.print(":"); | |
lcd.setCursor(3, 1); | |
lcd.print(minute()); | |
lcd.setCursor(5, 1); | |
lcd.print(":"); | |
lcd.setCursor(6, 1); | |
lcd.print(second()); | |
delay(10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment