| Line 57: |
Line 57: |
| | #!/usr/bin/env python | | #!/usr/bin/env python |
| | | | |
| − | # import the rusocsci.buttonbox module
| + | import threading |
| − | from rusocsci import buttonbox | + | from pylsl import StreamInfo, StreamOutlet |
| | | | |
| − | # make a buttonbox
| + | def getData(): |
| − | bb = buttonbox.Buttonbox()
| + | while running: |
| | + | buffer_in = getSensorData() |
| | + | send_data = True |
| | + | time.sleep(0.001) |
| | | | |
| − | # wait for a single button press
| + | info = StreamInfo( |
| − | bb.sendMarker(100) #This is your marker code, range code 1-255
| + | name='MyStream', |
| − | core.wait(0.002) #2ms delay for the code to be recorded by brainvision; 2ms->500hz sampling rate
| + | type='COP', |
| − | bb.sendMarker(0) #Back to 0; now ready to send a new code
| + | channel_count=4, |
| − | </syntaxhighlight>
| + | 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 |
| | | | |
| | ==References== | | ==References== |