Changes

Jump to navigation Jump to search
619 bytes added ,  11:14, 1 February 2022
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>

Navigation menu