Esempio n. 1
0
voltage = np.zeros_like(daq.voltage)
voltage[:, 0] = wheel_signal
voltage[:, 1] = wheel_brake_signal
voltage[:, 2] = 5 #focusing objective
voltage[:, 3] = 0 #murrrcle
voltage[:, 6] = laser_signal
voltage[:, 7] = laser_signal

daq.set_voltage(voltage)
daq.scan()
num_writes = 0
writes_per_change = 10
which_facet = 0
while True:
    try:
        daq.write_voltage()
        num_writes += 1
        print "Num writes:", num_writes
##        if num_writes % writes_per_change == writes_per_change - 1:
##            which_facet += 1
##            which_facet = which_facet % num_facets
##            print "Changing to facet", which_facet
##            voltage[:, 6] = lagged_laser_signals[which_facet]
##            voltage[:, 7] = lagged_laser_signals[which_facet]
##            daq.set_voltage(voltage)
    except KeyboardInterrupt:
        break
daq.stop_scan()
daq.close()
raw_input("Hit enter to continue...")
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Example data logger that saves DAQ data to a CSV file in real-time"""

import csv
from time import time
from daq import DAQ

d = DAQ()

try:
    dataFile = open('data.csv', 'w+')  # overwrite data file if it exists
    writer = csv.writer(dataFile, quoting=csv.QUOTE_ALL)
    writer.writerow(['date'] + d.source_labels)  # table headers
    while True:  # kill/interrupt script to end program
        data = [time()] + d.data()
        print(data)
        writer.writerow(data)
finally:  # close/release everything
    d.close()
    dataFile.close()
Esempio n. 3
0
voltage = np.zeros_like(daq.voltage)
voltage[:, 0] = wheel_signal
voltage[:, 1] = wheel_brake_signal
voltage[:, 2] = 5  #focusing objective
voltage[:, 3] = 0  #murrrcle
voltage[:, 6] = laser_signal
voltage[:, 7] = laser_signal

daq.set_voltage(voltage)
daq.scan()
num_writes = 0
writes_per_change = 10
which_facet = 0
while True:
    try:
        daq.write_voltage()
        num_writes += 1
        print "Num writes:", num_writes
##        if num_writes % writes_per_change == writes_per_change - 1:
##            which_facet += 1
##            which_facet = which_facet % num_facets
##            print "Changing to facet", which_facet
##            voltage[:, 6] = lagged_laser_signals[which_facet]
##            voltage[:, 7] = lagged_laser_signals[which_facet]
##            daq.set_voltage(voltage)
    except KeyboardInterrupt:
        break
daq.stop_scan()
daq.close()
raw_input("Hit enter to continue...")