Skip to content

Instantly share code, notes, and snippets.

@hndr91
Last active March 2, 2017 11:22
Show Gist options
  • Save hndr91/9eb42784aa0e65bac778d3f0df7ff3e6 to your computer and use it in GitHub Desktop.
Save hndr91/9eb42784aa0e65bac778d3f0df7ff3e6 to your computer and use it in GitHub Desktop.
How to setup emokit properly on mac. Emokit https://github.com/openyou/emokit

#How to Setup Emokit Properly on Mac Emokit : https://github.com/openyou/emokit

###Prerequisites Homebrew and python installed

###Dependencies

  1. hidapi - https://github.com/signal11/hidapi
  2. pyhidapi - https://github.com/NF6X/pyhidapi
  3. pygame - http://pygame.org/wiki/MacCompile

###Installation ####Install hidapi

  1. Download / clone hidapi repo
$ git clone https://github.com/signal11/hidapi
  1. Go to hidapi directory and install as shared library
$ ./bootstrap
$ ./configure
$ make
$ sudo make install

####Install pyhidapi

  1. Download / clone pyhidapi repo
$ git clone https://github.com/NF6X/pyhidapi
  1. Go to pyhidapi directory and install
$ ./setup.py install --user

####Install pygame

$ brew install mercurial
$ brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi
$ pip install hg+http://bitbucket.org/pygame/pygame

####Install Emokit

  1. Download / clone emokit repo
$ git clone https://github.com/openyou/emokit
  1. Go to python/ directory
  2. Install emokit
$ python setup.py install

###Code Example

import emokit.emotiv as h

if __name__ == "__main__":
    with h.Emotiv() as headset:
        while True:
            packet = headset.dequeue()
            if packet is not None:
                f7 = packet.sensors['F7']['value']
                if f7 is not None:
                    outputF7.write('%s \n'%f7)
                    print("F7 :{f7_value} - {f7_quality}".format(
                        f7_value=packet.sensors['F7']['value'],
                        f7_quality=packet.sensors['F7']['quality'])
                    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment