forked from ssandeep96/BMW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
staticThreshold.py
40 lines (31 loc) · 1.02 KB
/
staticThreshold.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
import easygopigo3
import time
import numpy as np
from mindwavemobile.MindwaveDataPointReader import MindwaveDataPointReader
mindwaveDataPointReader = MindwaveDataPointReader()
# connect to the mindwave mobile headset
mindwaveDataPointReader.start()
#Instantiate GoPiGo Object
GPG = easygopigo3.EasyGoPiGo3()
#control loop for pi
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('***'),
if dataPoint.__class__.__name__ == 'AttentionDataPoint':
print dataPoint
dataPoint = int(str(dataPoint))
if dataPoint > 60:
GPG.forward()
else: GPG.stop()
except:
KeyboardInterrupt()
bye = "Goodbye"
print bye
GPG.stop()