Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import serial
- ser = serial.Serial('/dev/ttyAMA0', 9600, timeout=1)
- ser.write("Z1")
- zOne = ser.read(4)
- ser.write("Z2")
- zTwo = ser.read(4)
- print 'Zone 1 ADC = %s' % (zOne)
- print 'Zone 2 ADC = %s' % (zTwo)
- zOneVolts = (float(zOne) * .00322265625)
- zTwoVolts = (float(zTwo) * .00322265625)
- print 'Zone 1 Voltage = {}' .format(zOneVolts)
- print 'Zone 2 Voltage = {}' .format(zTwoVolts)
- zOneC = (zOneVolts - .563) / .01
- zTwoC = (zTwoVolts - .563) / .01
- print 'Zone 1 is {}C' .format(zOneC)
- print 'Zone 2 is {}C' .format(zTwoC)
- zOneF = (zOneC * 9 / 5) + 32
- zTwoF = (zTwoC * 9 / 5) + 32
- print 'Zone 1 is {}F' .format(zOneF)
- print 'Zone 2 is {}F' .format(zTwoF)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement