Esempio n. 1
0
#!/usr/bin/env python

### Load the module:
from PfeifferVacuum import MaxiGauge

### Initialize an instance of the MaxiGauge controller with
### the handle of the serial terminal it is connected to
mg = MaxiGauge('/dev/ttyUSB0')

### Run the self check (not needed)
print(mg.checkDevice())

### Set device characteristics (here: change the display contrast)
print("Set the display contrast to: %d" % mg.displayContrast(10))

### Read out the pressure gauges
print(mg.pressures())

### Display the value of the pressure gauges for 20 repeated read outs
for i in range(20):
    ps = mg.pressures()
    print "Sensor 1: %4e mbar" % ps[0].pressure + "Sensor 6: %4e mbar" % ps[5].pressure
Esempio n. 2
0
### Load the module:
from PfeifferVacuum import MaxiGauge, MaxiGaugeError
import time
import sys

### Initialize an instance of the MaxiGauge controller with
### the handle of the serial terminal it is connected to
mg = MaxiGauge('/dev/ttyUSB1')

### Read out the pressure gauges
while True:
    startTime = time.time()

    try:
        ps = mg.pressures()
    except MaxiGaugeError, mge:
        print mge
        continue
    line = ""
    for sensor in ps:
        #print sensor values
        if sensor.status in [0,1,2]: # if normal, over or under range
            line += str(sensor.pressure)
        line += ", "
    print line[0:-2] # omit the last comma and space
    sys.stdout.flush()
    
    # do this every second
    endTime = time.time()-startTime
    time.sleep(max([0.0, 1.0-endTime]))
Esempio n. 3
0
#!/usr/bin/env python

### Load the module:
from PfeifferVacuum import MaxiGauge

### Initialize an instance of the MaxiGauge controller with
### the handle of the serial terminal it is connected to
mg = MaxiGauge('/dev/ttyUSB0')

### Run the self check (not needed)
print(mg.checkDevice())

### Set device characteristics (here: change the display contrast)
print("Set the display contrast to: %d" % mg.displayContrast(10))

### Read out the pressure gauges
print(mg.pressures())

### Display the value of the pressure gauges for 20 repeated read outs
for i in range(20):
    ps = mg.pressures()
    print "Sensor 1: %4e mbar" % ps[0].pressure + "Sensor 6: %4e mbar" % ps[
        5].pressure