if i == 10: Vin = 150.0 if i == 200: Vin = 10.0 if i == 400: Vin = 150.0 # Write output in milliVolts (0-255) mV[i] = min(150.0, max(0.0, Vin)) a.writeVoltage(mV[i]) # Add data to array newData = np.array([[tm, mV[i], T[i], 320.0]]) print('{:10.2f} {:10.2f} {:10.2f} {:10.2f} {:10.2f}'.format( tm, mV[i], T[i], K, tau)) a.addData(newData) # Update plots a.updatePlots() # Open web-viewer on 10th cycle if i == 10: apm_web(s, b) # Write data to file a.saveData() # Allow user to end loop with Ctrl-C except KeyboardInterrupt: # Write data to file a.saveData()