forked from ssandeep96/BMW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathble_test.py
45 lines (31 loc) · 1.28 KB
/
ble_test.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 numpy as np
from mindwavemobile.MindwaveDataPointReader import MindwaveDataPointReader
mindwaveDataPointReader = MindwaveDataPointReader()
# connect to the mindwave mobile headset
mindwaveDataPointReader.start()
# read one data point, data point types are specified in MindwaveDataPoints.py
i = 0
meditationList = []
try:
while(True):
dataPoint = mindwaveDataPointReader.readNextDataPoint()
# print dataPoint.__class__.__name__
# classes: AttentionDataPoint, MeditationDataPoint, RawDataPoint
# EEGPowersDataPoint: delta, theta, lowAlpha, highAlpha,
# lowBeta, highBeta, lowGamma, midGamma
if dataPoint.__class__.__name__ == 'AttentionDataPoint':
#if (dataPoint > 75):
#print('***'),
#print "i: ", dataPoint
i += 1
if dataPoint.__class__.__name__ == 'MeditationDataPoint':
#print (dataPoint)
a = int(str(dataPoint))
print(a)
#meditationList.append( int(dataPoint) )
except KeyboardInterrupt:
print 'Exited Program'
mdarray = np.array(meditationList)
#print 'Meditation std: ', mdarray.std()
#print 'Meditation avg: ', mdarray.mean()
#print 'Meditation median: ', mdarray.median()