/Designs/Measuring_instruments/ISMS01A/SW/ISMS_read.py
27,9 → 27,15
},
bus = [
{
"name": "current_sensor",
"name": "current_sensor1",
"type": "vcai2c01",
"address": 0x68,
},
{
"name": "current_sensor2",
"type": "vcai2c01",
"address": 0x6a,
},
],
)
cfg.initialize()
36,7 → 42,7
 
print "Current loop sensor example \r\n"
print "Time, channel #1, channel #2, channel #3 , channel #4 \r\n"
sensor = cfg.get_device("current_sensor")
sensor1 = cfg.get_device("current_sensor1")
time.sleep(0.5)
 
#### Data Logging ###################################################
45,21 → 51,21
with open(log_file, "a") as f:
while True:
 
sensor.setADC(channel = 1, gain = 2, sample_rate = 3.75);
sensor1.setADC(channel = 1, gain = 2, sample_rate = 3.75);
time.sleep(0.5)
channel1 = sensor.readCurrent();
channel1 = sensor1.readCurrent();
 
sensor.setADC(channel = 2, gain = 1, sample_rate = 15);
sensor1.setADC(channel = 2, gain = 1, sample_rate = 15);
time.sleep(0.5)
channel2 = sensor.readADC();
channel2 = sensor1.readCurrent();
 
sensor.setADC(channel = 3, gain = 1, sample_rate = 15);
sensor1.setADC(channel = 3, gain = 1, sample_rate = 15);
time.sleep(0.5)
channel3 = sensor.readADC();
channel3 = sensor1.readCurrent();
 
sensor.setADC(channel = 4, gain = 1, sample_rate = 15);
sensor1.setADC(channel = 4, gain = 1, sample_rate = 15);
time.sleep(0.5)
channel4 = sensor.readADC();
channel4 = sensor1.readCurrent();
 
sys.stdout.write("%s \t %0.3f \t %0.3f \t %0.3f \t %0.3f \n" % (datetime.datetime.now().isoformat(), channel1, channel2, channel3, channel4))