From 593a945d9094abc98758d7372e0196fa577b3f2b Mon Sep 17 00:00:00 2001 From: Deon Spengler Date: Mon, 18 Jun 2018 15:59:16 +0200 Subject: [PATCH] Updated to current config --- bspwm/localtemp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 bspwm/localtemp diff --git a/bspwm/localtemp b/bspwm/localtemp new file mode 100755 index 0000000..8e73799 --- /dev/null +++ b/bspwm/localtemp @@ -0,0 +1,15 @@ +#!/usr/bin/python +from pathlib import Path +from serial import Serial + +def main(): + serialport = "/dev/ttyUSB0" + baudrate = 9600 + + if Path(serialport).is_char_device(): + with Serial(serialport, baudrate) as serial: + serial.write(b'temperature\n') + print("{:0.1f}°".format(float(serial.readline()))) + +if __name__ == '__main__': + main()