In [1]:
from pynq.overlays.base import BaseOverlay
base = BaseOverlay("base.bit")
In [2]:
from pynq.lib import Pmod_TMP2
mytmp = Pmod_TMP2(base.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()