<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 PMOD TC1 Sensor demonstration
This demonstration shows how to use the PmodTC1. You will also see how to plot a graph using matplotlib.
The PmodTC1 is required.
The thermocouple sensor is initialized and set to log a reading every 1 second.  The temperature of the sensor
can be changed by touching it with warm fingers or by blowing on it.
1. Use TC1 read() to read the current temperature
Step1:  2. Starting logging temperature once every second
Step2:  3. Modifying the temperture
Touch the thermocouple with warm fingers; or
Blow on the thermocouple with cool air
Stop the logging whenever you are finished trying to change the sensor's value.
Step3:  4. Plot values over time
<ASSISTANT_TASK:>
Python Code:
from pynq import Overlay
Overlay("base.bit").download()
from pynq.iop import Pmod_TC1
from pynq.iop import PMODB
# TC1 sensor is on PMODB
my_tc1 = Pmod_TC1(PMODB)
r = my_tc1.read()
print('Raw Register Value: %08x hex' % r)
print('Ref Junction Temp:  %.4f' % my_tc1.reg_to_ref(r))
print('Thermocouple Temp:  %.2f' % my_tc1.reg_to_tc(r))
print('Alarm flags:        %08x hex' % my_tc1.reg_to_alarms(r))
Explanation: PMOD TC1 Sensor demonstration
This demonstration shows how to use the PmodTC1. You will also see how to plot a graph using matplotlib.
The PmodTC1 is required.
The thermocouple sensor is initialized and set to log a reading every 1 second.  The temperature of the sensor
can be changed by touching it with warm fingers or by blowing on it.
1. Use TC1 read() to read the current temperature
End of explanation
my_tc1.start_log()
Explanation: 2. Starting logging temperature once every second
End of explanation
my_tc1.stop_log()
log = my_tc1.get_log()
Explanation: 3. Modifying the temperture
Touch the thermocouple with warm fingers; or
Blow on the thermocouple with cool air
Stop the logging whenever you are finished trying to change the sensor's value.
End of explanation
%matplotlib inline
import matplotlib.pyplot as plt
tc = [my_tc1.reg_to_tc(v) for v in log]
ref = [my_tc1.reg_to_ref(v) for v in log]
plt.plot(range(len(tc)), tc, 'ro', label='Thermocouple')
plt.plot(range(len(ref)), ref, 'bo', label='Ref Junction')
plt.title('TC1 Sensor log')
plt.axis([0, len(log), min(tc+ref)*0.9, max(tc+ref)*1.1])
plt.legend()
plt.xlabel('Sample Number')
plt.ylabel('Temperature (C)')
plt.grid()
plt.show()
Explanation: 4. Plot values over time
End of explanation
<END_TASK>