This commit is contained in:
Arti Zirk 2016-10-14 01:52:46 +02:00
parent 49c6460303
commit 16a9bd2f4e
2 changed files with 3 additions and 1 deletions

View File

@ -16,7 +16,7 @@ setInterval(function() {
}, 500); }, 500);
function createTimeline() { function createTimeline() {
var chart = new SmoothieChart({grid:{fillStyle:'transparent'}}); var chart = new SmoothieChart({grid:{fillStyle:'transparent'}, labels:{fillStyle:'#000000'}});
chart.addTimeSeries(random, { strokeStyle: 'rgba(0, 0, 0, 1)', fillStyle: 'rgba(0, 0, 0, 0.1)', lineWidth: 4 }); chart.addTimeSeries(random, { strokeStyle: 'rgba(0, 0, 0, 1)', fillStyle: 'rgba(0, 0, 0, 0.1)', lineWidth: 4 });
chart.streamTo(document.getElementById("chart"), 500); chart.streamTo(document.getElementById("chart"), 500);
} }

View File

@ -110,6 +110,8 @@ def stream(dev):
with serial.Serial(dev, timeout=1) as s: with serial.Serial(dev, timeout=1) as s:
while True: while True:
temperature = s.readline().decode().strip() temperature = s.readline().decode().strip()
if not temperature:
continue
print("temperature", temperature) print("temperature", temperature)
temps.append(temperature) temps.append(temperature)