add scripts for debugging
parent
1e51c8a151
commit
6f41373992
@ -0,0 +1,7 @@
|
|||||||
|
make program
|
||||||
|
avrdude -c atmelice_isp -p m328p -U hfuse:w:0x99:m
|
||||||
|
echo "Power cycle now!"
|
||||||
|
read
|
||||||
|
avarice -5 -w -P atmega328p :4242 &
|
||||||
|
read
|
||||||
|
avrdude -c atmelice_isp -p m328p -U hfuse:w:0xD9:m
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
avarice -5 -w -P atmega328p :4242 &
|
||||||
|
sleep 2
|
||||||
|
avrdude -c atmelice_isp -p m328p -U hfuse:w:0xD9:m
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
import time
|
||||||
|
from simple_pid import PID
|
||||||
|
from itertools import count
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from matplotlib.animation import FuncAnimation
|
||||||
|
|
||||||
|
import minimalmodbus
|
||||||
|
|
||||||
|
tempSens = minimalmodbus.Instrument('/dev/ttyUSB0', 1)
|
||||||
|
tempSens.serial.baudrate = 38400
|
||||||
|
|
||||||
|
plt.style.use('fivethirtyeight')
|
||||||
|
|
||||||
|
x_values = []
|
||||||
|
y_values = []
|
||||||
|
|
||||||
|
index = count()
|
||||||
|
|
||||||
|
|
||||||
|
def animate(i):
|
||||||
|
try:
|
||||||
|
#temp1 = tempSens.read_float(1, functioncode=4, byteorder=0) / 100
|
||||||
|
#temp2 = tempSens.read_float(3, functioncode=4, byteorder=0) / 100
|
||||||
|
#temp3 = tempSens.read_float(5, functioncode=4, byteorder=0) / 100
|
||||||
|
|
||||||
|
#temp = tempSens.read_register(1)
|
||||||
|
temp2 = tempSens.read_float(3, functioncode=4)
|
||||||
|
|
||||||
|
y_values.append(temp2)
|
||||||
|
x_values.append(next(index))
|
||||||
|
print(tempSens.read_float(11, functioncode=4), end="\t")
|
||||||
|
print(temp2)
|
||||||
|
|
||||||
|
plt.cla()
|
||||||
|
plt.scatter(x_values, y_values)
|
||||||
|
except Exception as e: print(e)
|
||||||
|
|
||||||
|
|
||||||
|
ani = FuncAnimation(plt.gcf(), animate, 2000)
|
||||||
|
|
||||||
|
|
||||||
|
plt.tight_layout()
|
||||||
|
plt.show()
|
||||||
Loading…
Reference in New Issue