|
a |
|
b/python/example_export.py |
|
|
1 |
# This is an example of popping a packet from the Emotiv class's packet queue |
|
|
2 |
# Additionally, exports the data to a CSV file. |
|
|
3 |
# You don't actually need to dequeue packets, although after some time allocation lag may occur if you don't. |
|
|
4 |
|
|
|
5 |
|
|
|
6 |
import platform |
|
|
7 |
import time |
|
|
8 |
|
|
|
9 |
from emokit.emotiv import Emotiv |
|
|
10 |
|
|
|
11 |
if platform.system() == "Windows": |
|
|
12 |
pass |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
if __name__ == "__main__": |
|
|
16 |
with Emotiv(display_output=True, verbose=True, write=True) as headset: |
|
|
17 |
print("Serial Number: %s" % headset.serial_number) |
|
|
18 |
print("Exporting data... press control+c to stop.") |
|
|
19 |
|
|
|
20 |
while headset.running: |
|
|
21 |
try: |
|
|
22 |
packet = headset.dequeue() |
|
|
23 |
except Exception: |
|
|
24 |
headset.stop() |
|
|
25 |
time.sleep(0.001) |