from ADC import *
adc=Adc()
def test_Adc():
try:
while True:
Left_IDR=adc.recvADC(0)
print ("The photoresistor voltage on the left is "+str(Left_IDR)+"V")
Right_IDR=adc.recvADC(1)
print ("The photoresistor voltage on the right is "+str(Right_IDR)+"V")
Power=adc.recvADC(2)
print ("The battery voltage is "+str(Power*3)+"V")
time.sleep(1)
print '\n'
except KeyboardInterrupt:
print "\nEnd of program"
This function has only one input parameter, which can be 0, 1 or 2.
When the input is 0, the value of this function is the voltage value of the left photoresistor.
When the input is 1, the value of this function is the voltage value of the right photoresistor.
When the input is 2, the value of this function is the voltage value of each battery. After multiplying by 3,
it is the actual battery voltage value