Skip to content

Instantly share code, notes, and snippets.

@michaelsarduino
Last active January 30, 2016 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelsarduino/94599c74994c8598dcf1 to your computer and use it in GitHub Desktop.
Save michaelsarduino/94599c74994c8598dcf1 to your computer and use it in GitHub Desktop.
#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