Merge remote-tracking branch 'origin/develop' into windows_ready
This commit is contained in:
commit
e61d71b08a
49
examples/test_input.py
Executable file
49
examples/test_input.py
Executable file
@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import lasp
|
||||||
|
# Get handle to stream manager
|
||||||
|
mgr = lasp.StreamMgr.getInstance()
|
||||||
|
import time
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
ds = mgr.getDeviceInfo()
|
||||||
|
# Search for a device
|
||||||
|
for i, d in enumerate(ds):
|
||||||
|
print(f'{i}: ' + d.device_name)
|
||||||
|
|
||||||
|
d = ds[0] # Create a configuration and enable some input channels
|
||||||
|
config = lasp.DaqConfiguration(d)
|
||||||
|
config.inchannel_config[0].enabled = True
|
||||||
|
config.inchannel_config[1].enabled = True
|
||||||
|
# Choose a different number of frames per block
|
||||||
|
config.framesPerBlockIndex = 2
|
||||||
|
|
||||||
|
# Start a stream with a configuration
|
||||||
|
mgr.startStream(config)
|
||||||
|
|
||||||
|
def reset_cb(daq):
|
||||||
|
print('Reset called')
|
||||||
|
|
||||||
|
def cb(data):
|
||||||
|
# Print something on callback
|
||||||
|
print(data.shape)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
# Attach the indata handler to the stream
|
||||||
|
#i = lasp.InDataHandler(mgr, cb, reset_cb)
|
||||||
|
|
||||||
|
ppm = lasp.PPMHandler(mgr)
|
||||||
|
#del ppm
|
||||||
|
del mgr
|
||||||
|
|
||||||
|
#del i
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
val, clip = ppm.getCurrentValue()
|
||||||
|
print(val)
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
#print(f'{val[0]} {val[1]}', end='')
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
||||||
|
# mgr.stopStream(lasp.StreamMgr.StreamType.input)
|
Loading…
Reference in New Issue
Block a user