DataHub: Difference between revisions
Jump to navigation
Jump to search
Wiki-admin (talk | contribs) |
Wiki-admin (talk | contribs) |
||
| Line 54: | Line 54: | ||
==Usage== | ==Usage== | ||
=== Python === | === Python === | ||
A short example for sending lsl streaming data: | |||
<syntaxhighlight lang="python" line> | |||
#!/usr/bin/env python | |||
import threading | |||
from pylsl import StreamInfo, StreamOutlet | |||
def getData(): | |||
while running: | |||
buffer_in = getSensorData() | |||
send_data = True | |||
time.sleep(0.001) | |||
info = StreamInfo( | |||
name='MyStream', | |||
type='COP', | |||
channel_count=4, | |||
nominal_srate = 200, | |||
source_id='BalanceBoard_stream' | |||
) | |||
outlet = StreamOutlet(info) | |||
threading.Thread(target=getData).start() | |||
while running == True: | |||
if send_data: | |||
outlet.push_chunk(buffer_in) | |||
send_data = False | |||
</syntaxhighlight> | |||
A short example for sending lsl streaming data: | A short example for sending lsl streaming data: | ||
<syntaxhighlight lang="python" line> | <syntaxhighlight lang="python" line> | ||