diff --git a/config.ini b/config.ini index ef2aa391ebaba901c4a27231a7641fee932b03f7..b7d468db9301c14e618c68702fa073d65a79cb85 100644 --- a/config.ini +++ b/config.ini @@ -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] diff --git a/main.py b/main.py index f4654d464223cf61bf7f9071af17f8ea58c61aee..362ec587b3da664062913b9aad74b5cc00b13b4c 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,7 @@ 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() diff --git a/plot.sh b/plot.sh new file mode 100644 index 0000000000000000000000000000000000000000..fccf29cb591ee64048b46b9ee9e24dba74f228ba --- /dev/null +++ b/plot.sh @@ -0,0 +1,4 @@ +( + echo "plot '< cat data.log' with lines"; + while :; do sleep .1; echo replot; done +) | gnuplot -persist