Commit 9b4fa8fb authored by Nelso Jost's avatar Nelso Jost

ADD: real time plot

parent 37d1b33e
......@@ -3,12 +3,12 @@ serial_port = /dev/ttyACM0
baud_rate = 9600
[maze]
cycle = //---\\---
cycle = //\\//\\
y0 = 300
dx = 100
dy = 100
width = 200
speed = 120
speed = 150
line_color = white
[player]
......
from paigamu import *
import serial
import serial
import time
import configparser
import ast
......@@ -177,6 +178,7 @@ class JoystickRespirometro:
def __init__(self, serial_port, baud_rate):
self._state = 0
self._last_read = 0
self.t0 = time.time()
try:
self._sercon = serial.Serial(serial_port, baud_rate, timeout=1)
self._enabled = True
......@@ -216,6 +218,9 @@ class JoystickRespirometro:
print(read, dv, self._state)
with open('data.log', 'a') as f:
f.write('{}\t{}\n'.format(time.time() - self.t0, read))
def update(self):
if self._enabled:
self.timer.update()
......
(
echo "plot '< cat data.log' with lines";
while :; do sleep .1; echo replot; done
) | gnuplot -persist
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment