diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2018-07-01 17:52:05 +0200 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2018-07-01 17:55:51 +0200 |
commit | 84eb89453189f30332bbf96df4f992560ce2e884 (patch) | |
tree | d0c9cf45396f40f9ac186b4e9c798d1295d6319f | |
parent | 3e65c99751da7578e80dcd791010a28244b21352 (diff) |
Write and read ascii to the serial line
-rwxr-xr-x | client/ur_fuzzy_alarm_clock.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/client/ur_fuzzy_alarm_clock.py b/client/ur_fuzzy_alarm_clock.py index d6e5a1b..cb4e509 100755 --- a/client/ur_fuzzy_alarm_clock.py +++ b/client/ur_fuzzy_alarm_clock.py @@ -33,15 +33,15 @@ class FuzzyAlarmClock: self.mock = False def set_time_to_now(self): - now = 's'+datetime.datetime.now().strftime("%y%m%d%u%H%M%S") + now = b's'+datetime.datetime.now().strftime("%y%m%d%u%H%M%S").encode('ascii') self.serial.write(now) def read_alarms(self, n): data = [] self.serial.flushInput() - self.serial.write('p') + self.serial.write(b'p') for i in range(n): - data.append(self.serial.readline()) + data.append(self.serial.readline().decode('ascii')) for i in range(n): data[i] = data[i].split(' ')[2:-1] days = [] @@ -59,7 +59,7 @@ class FuzzyAlarmClock: s += "%02x" % (b0) for val in values[8:]: s += "%02x" % (val) - self.serial.write(s) + self.serial.write(s.encode('ascii')) class ModEdit(urwid.IntEdit): |