Line 27: |
Line 27: |
| | downloads = | | | downloads = |
| | manuals = {{bulleted list | | | manuals = {{bulleted list |
− | | [https://docs.unity3d.com/Manual/index.html Official Documentation] | + | | [https://docs.openbci.com/ Documentation] |
| + | | [https://sccn.ucsd.edu/~mgrivich/LSL_Validation.html LSL Validation] |
| + | | [https://labstreaminglayer.readthedocs.io/info/supported_devices.html Supported Devices and Tools] |
| + | }} |
| + | | header2 = Templates |
| + | | data2 = {{bulleted list |
| + | | [https://surfdrive.surf.nl/files/index.php/s/qggfMMKsnUIDO0k example scripts (zip)] |
| }} | | }} |
| }} | | }} |
Line 53: |
Line 59: |
| | | |
| ==Usage== | | ==Usage== |
− | == Python == | + | === Python === |
| + | A short example for sending lsl streaming data: |
| <syntaxhighlight lang="python" line> | | <syntaxhighlight lang="python" line> |
| #!/usr/bin/env python | | #!/usr/bin/env python |
| | | |
− | # import the rusocsci.buttonbox module
| + | import threading |
− | from rusocsci import buttonbox | + | from pylsl import StreamInfo, StreamOutlet |
| + | |
| + | def getData(): |
| + | while running: |
| + | buffer_in = getSensorData() |
| + | send_data = True |
| + | time.sleep(0.001) |
| | | |
− | # make a buttonbox
| + | info = StreamInfo( |
− | bb = buttonbox.Buttonbox()
| + | name='MyStream', |
| + | type='COP', |
| + | channel_count=4, |
| + | nominal_srate = 200, |
| + | source_id='BalanceBoard_stream' |
| + | ) |
| + | outlet = StreamOutlet(info) |
| | | |
− | # wait for a single button press
| + | threading.Thread(target=getData).start() |
− | bb.sendMarker(100) #This is your marker code, range code 1-255
| + | while running == True: |
− | core.wait(0.002) #2ms delay for the code to be recorded by brainvision; 2ms->500hz sampling rate
| + | if send_data: |
− | bb.sendMarker(0) #Back to 0; now ready to send a new code
| + | outlet.push_chunk(buffer_in) |
| + | send_data = False |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | ==References== | + | A short example for receiving lsl data: |
− | <references />
| + | <syntaxhighlight lang="python" line> |
| + | #!/usr/bin/env python |
| | | |
− | ==External Links== <!-- Optional --> | + | from pylsl import StreamInlet, resolve_stream |
− | *{{Official website|https://unity3d.com}}
| + | |
− | *[https://docs.unity3d.com/Manual/index.html Official Documentation]
| + | streams = resolve_stream('name', 'MyStream') |
| + | #streams = resolve_streams() |
| + | |
| + | inlet = StreamInlet(streams[0]) |
| + | while True: |
| + | sample, timestamp = inlet.pull_sample() |
| + | print(timestamp, sample) |
| + | </syntaxhighlight> |