In [1]:
from pynq import Overlay
Overlay("base.bit").download()
In [2]:
from pynq.iop import Pmod_TMP2
from pynq.iop import PMODB
mytmp = Pmod_TMP2(PMODB)
temperature = mytmp.read()
print(str(temperature) + " C")
In [3]:
mytmp.start_log()
The default interval between samples is 1 second. So wait for at least 10 seconds to get enough samples.
During this period, try to press finger on the sensor to increase its temperature reading.
Stop the logging whenever done trying to change sensor's value.
In [4]:
mytmp.stop_log()
log = mytmp.get_log()
In [5]:
%matplotlib inline
import matplotlib.pyplot as plt
plt.plot(range(len(log)), log, 'ro')
plt.title('TMP2 Sensor log')
plt.axis([0, len(log), min(log), max(log)])
plt.show()