Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
DataHub
(view source)
Revision as of 11:15, 1 February 2022
260 bytes removed
,
11:15, 1 February 2022
→Python
Line 83:
Line 83:
</syntaxhighlight>
</syntaxhighlight>
−
A short example for
sending
lsl
streaming
data:
+
A short example for
receiving
lsl data:
<syntaxhighlight lang="python" line>
<syntaxhighlight lang="python" line>
#!/usr/bin/env python
#!/usr/bin/env python
−
import threading
+
from pylsl import
StreamInlet
,
resolve_stream
−
from pylsl import
StreamInfo
,
StreamOutlet
−
def getData():
+
streams
=
resolve_stream
(
'name', 'MyStream'
)
−
while running:
+
#streams
=
resolve_streams
()
−
buffer_in
=
getSensorData
()
−
send_data
=
True
−
time.sleep
(
0.001
)
−
info
=
StreamInfo
(
+
inlet
=
StreamInlet
(
streams[0])
−
name='MyStream',
+
while True:
−
type='COP',
+
sample
,
timestamp
=
inlet
.
pull_sample
()
−
channel_count=4,
+
print
(
timestamp, sample
)
−
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>
</syntaxhighlight>
Wiki-admin
Bureaucrats
,
Administrators
1,658
edits
Navigation menu
Personal tools
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Help
About
About the TSG
About this Wiki
FAQ
Disclaimer
Survey
Customer Survey
Tools
Special pages
Printable version