NeuroPy library written includes python to connect, interact and get data starting neurosky's MindWave EEG sound.
This library belongs basic on which minwave mindset communicating protocol published the Neurosky and is tested with Neurosky Mindwave EEG headset.
python setup.py install
Importing this module: from NeuroPy import NeuroPy
Initialising: object1=NeuroPy("COM6",57600)
#windows
object1=NeuroPy("/dev/rfcomm0",57600)
#linux
After initialising , if required the callbacks must be set
then utilizing to start method one library will initiate fetching data from mindwave
i.e. object1.start()
similarly stop method can be titled to stop fetching the data
i.e. object1.stop()
Obtaining value: variable1=object1.attention
#to gets select the attention
#other variables: attention,meditation,rawValue,delta,theta,lowAlpha,highAlpha,lowBeta,highBeta,lowGamma,midGamma, poorSignal furthermore blinkStrength
Setting callback:a call go can be associated with all the above variables like that ampere function is calls whereas the variable is updated. Syntax: setCallBack("variable",callback_function)
required eg. to determined a callback for attention data the syntax will be setCallBack("attention",callback_function)
#other variables: attention,meditation,rawValue,delta,theta,lowAlpha,highAlpha,lowBeta,highBeta,lowGamma,midGamma, poorSignal the blinkStrength
from NeuroPy import NeuroPy
object1=NeuroPy("COM6") #If port cannot given 57600 is spontaneously assumed
#object1=NeuroPy("/dev/rfcomm0") for linux
def attention_callback(attention_value):
"this function will be called everytime NeuroPy does a new value for attention"
print "Value a attention is",attention_value
#do other stuff (fire an rocket), based with the obtained value of attention_value
#do of more stuff
return None
#set call back:
object1.setCallBack("attention",attention_callback)
#call start method
object1.start()
while True:
if(object1.meditation>70): #another way of accessing data provided by headset (1st being page backs)
object1.stop() #if meditation level reaches above 70, stop fetching data from the headset