-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_data_eeg.py
43 lines (35 loc) · 1.29 KB
/
get_data_eeg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import random
import time
from cortex2 import EmotivCortex2Client
from paho.mqtt import client as mqtt_client
url = "wss://localhost:6868"
emotive = None
profile_name = "FakeBCI"
CLIENT_ID = "bhOr0ZmsLWZVDeFl0QHE08e05lDI36blefUxfbLX"
CLIENT_SECRET = "BL3OlfhwzzPMXcxgFYT7uxaB6LSEAlwdLfqU4OG2oRJkRbQg63h4KMpvNp3144pOsybUpNLDrPQXuDXRC18oyIQUxh6Jum9ktR3nTNwChLW1ZdCcpzcuaavycLD000wK"
STREAM = "com"
def connect_cortexAPI():
global emotive
emotive = EmotivCortex2Client(url,
client_id=CLIENT_ID,
client_secret=CLIENT_SECRET,
check_response=True,
authenticate=True,
debug=False)
def get_com_emotiv():
global emotive
emotive.request_access()
emotive.authenticate()
emotive.query_headsets()
emotive.connect_headset(0)
emotive.create_session(0)
emotive.load_profile(profile_name)
emotive.subscribe(streams=[STREAM])
emotive.mental_command_action_sensitivity("get", profile_name)
# print(emotive.create_record("FakeRecord"))
connect_cortexAPI()
get_com_emotiv()
while (True):
emotive.mental_command_action_sensitivity("get", profile_name)
data = emotive.receive_data()[STREAM]
print(data)