The procedure Read_MindWave is called by a timer and reads the packets into two global buffers: payloadlist and checksumlist.  In this project, we only want packets that contain the EEG power spectrum data, so packets of other lengths are discarded at this point. 

Read_MindWave then calls Parse_Data, whose primary purpose is to verify the contents of the packets contained in payloadlist by calculating a checksum and matching it against checksumlist.

Because MindWave sends numbers in a unique multi-byte format, Parse_Data also performs the function of binary to decimal conversion for multi-byte numbers.  

NeuroSky Communication Protocols:

Click HERE to download APK

Click HERE to download App Inventor .aia project file