-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathplot_rawdata.py
More file actions
38 lines (29 loc) · 826 Bytes
/
Copy pathplot_rawdata.py
File metadata and controls
38 lines (29 loc) · 826 Bytes
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
import numpy as np
import matplotlib.pyplot as plt
import mindwave, time
then = time.time()
now = time.time()
plt.axis([-2000, 2000, 0, 50])
plt.ion()
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."
while True:
#time.sleep(.5)
print "Attention: %s, Meditation: %s, Raw: %s" % (headset.attention, headset.meditation, headset.raw_value)
now = time.time()
duration = now - then
duration_sec = duration % 60
x = str(headset.raw_value)
y = str(duration_sec)
plt.scatter(x, y)
plt.pause(0.05)
while True:
plt.pause(0.05)