robintibor/python-mindwave-mobile

Get two or more values

mxgc96 opened this issue · 1 comments

Hello I'm trying to get multiple values simultaneously but it's not working. The code I use is the following:

if __name__ == '__main__':
    mindwaveDataPointReader = MindwaveDataPointReader()
    mindwaveDataPointReader.start()
    if (mindwaveDataPointReader.isConnected()):    
        while(True):
            dataPoint = mindwaveDataPointReader.readNextDataPoint()
            if dataPoint.__class__.__name__ == 'MeditationDataPoint':
                x = int(dataPoint.meditationValue)
                print("Meditation: " + str(x))
            elif dataPoint.__class__.__name__ == 'AtenttionDataPoint':
                y = int(dataPoint.attentionValue)
                print("Attention: " + str(y))

but only returns the meditation value. How could I get these values simultaneously separately since these two are not the only ones I need, Thank you.

It seems you have a typo:
AtenttionDataPoint
should be
AttentionDataPoint

you could try to spot these mistakes more easily by using some code like:

from mindwavemobile.MindwaveDataPoints import AttentionDataPoint, MeditationDataPoint
if dataPoint.__class__.__name__ == MeditationDataPoint.__name__:
    x = int(dataPoint.meditationValue)
    print("Meditation: " + str(x))
elif dataPoint.__class__.__name__ == AttentionDataPoint.__name__:
    y = int(dataPoint.attentionValue)
    print("Attention: " + str(y))