Python Client

The following script reads/writes the attributes of an ADC and a DAC. We assume that both devices are connected by a cable. Note that we set the DAC voltage limits before we change the output voltage.

#!/usr/bin/python 
#
# this script uses hires/exp/dac1 and hires/exp/adc1
#
from PyTango import *
import sys
import time

try :
    dac1 = DeviceProxy( "hires/exp/dac1")
    adc1 = DeviceProxy( "hires/exp/adc1")
    
    attr=dac1.read_attribute( "voltage")
    attr.name = "VoltageMax"
    attr.value = 10
    dac1.write_attribute( attr)
    attr.name = "VoltageMin"
    attr.value = 0
    dac1.write_attribute( attr)
    attr.name = "Voltage"
    attr.value = 3.5
    dac1.write_attribute( attr)
    
    attr=adc1.read_attribute( "value")
    print adc1.name(), ", attr:", attr.name, "=", attr.value
    
except :
    print "Failed with exception !"
    print sys.exc_info()[0]