bf
This commit is contained in:
parent
deaa7cceb7
commit
2d9991c295
32
rasp_grid.py
32
rasp_grid.py
@ -17,20 +17,23 @@ from IPython import embed
|
|||||||
from uldaq import (get_daq_device_inventory, DaqDevice, AInScanFlag, ScanStatus,
|
from uldaq import (get_daq_device_inventory, DaqDevice, AInScanFlag, ScanStatus,
|
||||||
ScanOption, create_float_buffer, InterfaceType, AiInputMode)
|
ScanOption, create_float_buffer, InterfaceType, AiInputMode)
|
||||||
|
|
||||||
def GPIO_setup():
|
def GPIO_setup(LED1_pin, LED2_pin, Button1_pin, Button2_pin):
|
||||||
# LED output pins
|
# LED output pins
|
||||||
GPIO.setmode(GPIO.BOARD)
|
GPIO.setmode(GPIO.BOARD)
|
||||||
|
|
||||||
GPIO.setup(11, GPIO.OUT) # 1
|
GPIO.setup(LED1_pin, GPIO.OUT) # 1
|
||||||
GPIO.output(11, GPIO.LOW)
|
GPIO.output(LED1_pin, GPIO.LOW)
|
||||||
GPIO.setup(13, GPIO.OUT) # 2
|
GPIO.setup(LED2_pin, GPIO.OUT) # 2
|
||||||
GPIO.output(13, GPIO.LOW)
|
GPIO.output(LED2_pin, GPIO.LOW)
|
||||||
|
|
||||||
LED_status = [False, False]
|
LED_status = [False, False]
|
||||||
|
|
||||||
# switch controlled input
|
# switch controlled input
|
||||||
GPIO.setup(16, GPIO.IN)
|
GPIO.setup(Button1_pin, GPIO.IN)
|
||||||
GPIO.setup(18, GPIO.IN)
|
GPIO.setup(Button2_pin, GPIO.IN)
|
||||||
|
|
||||||
|
# GPIO.setup(Button1_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
|
||||||
|
# GPIO.setup(Button2_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
|
||||||
|
|
||||||
return LED_status
|
return LED_status
|
||||||
|
|
||||||
@ -170,16 +173,21 @@ def main():
|
|||||||
file = os.path.join(path, 'traces-grid1.raw')
|
file = os.path.join(path, 'traces-grid1.raw')
|
||||||
f = open(file, 'wb')
|
f = open(file, 'wb')
|
||||||
|
|
||||||
f.close()
|
# f.close()
|
||||||
|
|
||||||
embed()
|
embed()
|
||||||
quit()
|
quit()
|
||||||
|
|
||||||
LED_status = GPIO_setup()
|
LED1_pin = 11
|
||||||
|
LED2_pin = 13
|
||||||
|
Button1_pin = 16
|
||||||
|
Button2_pin = 18
|
||||||
|
|
||||||
|
LED_status = GPIO_setup(LED1_pin, LED2_pin, Button1_pin, Button2_pin)
|
||||||
|
|
||||||
# DAQ setup
|
# DAQ setup
|
||||||
if True:
|
if True:
|
||||||
channels = 16
|
# channels = 16
|
||||||
|
|
||||||
status = ScanStatus.IDLE
|
status = ScanStatus.IDLE
|
||||||
|
|
||||||
@ -191,7 +199,7 @@ def main():
|
|||||||
high_channel = channels
|
high_channel = channels
|
||||||
|
|
||||||
samples_per_channel = 20000 # ToDo: ???? Buffer size ?!
|
samples_per_channel = 20000 # ToDo: ???? Buffer size ?!
|
||||||
rate = 20000
|
# rate = 20000
|
||||||
scan_options = ScanOption.CONTINUOUS
|
scan_options = ScanOption.CONTINUOUS
|
||||||
flags = AInScanFlag.DEFAULT
|
flags = AInScanFlag.DEFAULT
|
||||||
|
|
||||||
@ -250,7 +258,7 @@ def main():
|
|||||||
rate = ai_device.a_in_scan(low_channel, high_channel, input_mode, ranges[range_index], samples_per_channel,
|
rate = ai_device.a_in_scan(low_channel, high_channel, input_mode, ranges[range_index], samples_per_channel,
|
||||||
rate, scan_options, flags, data)
|
rate, scan_options, flags, data)
|
||||||
last_idx = 0
|
last_idx = 0
|
||||||
f = open('/media/pi/data1/test_file.raw', 'wb')
|
# f = open('/media/pi/data1/test_file.raw', 'wb')
|
||||||
|
|
||||||
|
|
||||||
# LED on when here ... wait for switch to start data aquisition
|
# LED on when here ... wait for switch to start data aquisition
|
||||||
|
Loading…
Reference in New Issue
Block a user