Toggle Navigation
Hatchery
Eggs
set-current-time
set_card10_time.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
set_card10_time.py
raw
Content
#!/usr/bin/env python3 import serial import time ser = serial.Serial('/dev/ttyACM0', baudrate=115200) ser.write(b'') print(ser.read(ser.in_waiting)) ser.write(b'import utime\r\n') print(ser.read(ser.in_waiting)) # there seems to be a small offset current_time = int(time.time()) - 398 ser.write('utime.set_unix_time({})\r\n'.format(current_time).encode('ascii')) print(ser.read(ser.in_waiting)) ser.write(b'')