Last active
October 1, 2017 04:16
-
-
Save SyNeto/e499f78036ccbe541630d8bbb4d40a2e 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
#!/usr/bin/env python | |
import serial | |
import atexit | |
from datetime import datetime | |
ser = serial.Serial('/dev/tty.usbmodem1411', 9600) | |
while True: | |
current_time = ser.readline().decode('utf-8') | |
print(datetime.utcfromtimestamp(int(current_time))) | |
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 <Wire.h> | |
#include "RTClib.h" | |
RTC_DS1307 rtc; | |
void setup () { | |
// for Leonardo/Micro/Zero | |
while (!Serial); | |
Serial.begin(9600); | |
if (! rtc.begin()) { | |
Serial.println("Couldn't find RTC"); | |
while (1); | |
} | |
} | |
void loop () { | |
DateTime now = rtc.now(); | |
Serial.println(now.unixtime()); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment