-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathplot2.py
42 lines (35 loc) · 931 Bytes
/
plot2.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
import time
import mindwave, time
import pyqtgraph as pg
import numpy as np
import mindwave, time
then = time.time()
headset = mindwave.Headset('COM10', 'CC0E')
time.sleep(2)
headset.connect()
print "Connecting..."
while headset.status != 'connected':
time.sleep(0.5)
if headset.status == 'standby':
headset.connect()
print "Retrying connect..."
print "Connected."
x = np.arange(100)
y = np.arange(100)
x[0] = 0.0000
y[0] = 0.0000
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
pw = pg.plot()
while True:
time.sleep(0.5)
i = 0
now = time.time()
duration = now - then
duration_scale = duration * 10
x[i] = headset.raw_value
y[i] = duration_scale
print x[i],y[i]
i = i+1
pw.plot(x, y, pen=pg.mkPen('b', width=2), label= 'EEG RAW Data', clear=False)
pg.QtGui.QApplication.processEvents()