Documentation ¶
Overview ¶
Package neurosky contains the Gobot adaptor and driver for the Neurosky Mindwave Mobile EEG.
Installing:
go get github.com/hybridgroup/gobot/platforms/neurosky
Example:
package main import ( "fmt" "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/platforms/neurosky" ) func main() { gbot := gobot.NewGobot() adaptor := neurosky.NewNeuroskyAdaptor("neurosky", "/dev/rfcomm0") neuro := neurosky.NewNeuroskyDriver(adaptor, "neuro") work := func() { gobot.On(neuro.Event("extended"), func(data interface{}) { fmt.Println("Extended", data) }) gobot.On(neuro.Event("signal"), func(data interface{}) { fmt.Println("Signal", data) }) gobot.On(neuro.Event("attention"), func(data interface{}) { fmt.Println("Attention", data) }) gobot.On(neuro.Event("meditation"), func(data interface{}) { fmt.Println("Meditation", data) }) gobot.On(neuro.Event("blink"), func(data interface{}) { fmt.Println("Blink", data) }) gobot.On(neuro.Event("wave"), func(data interface{}) { fmt.Println("Wave", data) }) gobot.On(neuro.Event("eeg"), func(data interface{}) { eeg := data.(neurosky.EEG) fmt.Println("Delta", eeg.Delta) fmt.Println("Theta", eeg.Theta) fmt.Println("LoAlpha", eeg.LoAlpha) fmt.Println("HiAlpha", eeg.HiAlpha) fmt.Println("LoBeta", eeg.LoBeta) fmt.Println("HiBeta", eeg.HiBeta) fmt.Println("LoGamma", eeg.LoGamma) fmt.Println("MidGamma", eeg.MidGamma) fmt.Println("\n") }) } robot := gobot.NewRobot("brainBot", []gobot.Connection{adaptor}, []gobot.Device{neuro}, work, ) gbot.AddRobot(robot) gbot.Start() }
For further information refer to neuroky README: https://github.com/hybridgroup/gobot/blob/master/platforms/neurosky/README.md
Index ¶
Constants ¶
const BTSync byte = 0xAA
const CodeAsicEEG byte = 0x83
ASIC EEG POWER 8 3-byte big-endian integers
const CodeAttention byte = 0x04
ATTENTION eSense 0-100
const CodeBlink byte = 0x16
BLINK strength 0-255
const CodeEx byte = 0x55
Extended code
const CodeMeditation byte = 0x05
MEDITATION eSense 0-100
const CodeSignalQuality byte = 0x02
POOR_SIGNAL quality 0-255
const CodeWave byte = 0x80
RAW wave value: 2-byte big-endian 2s-complement
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NeuroskyAdaptor ¶
type NeuroskyAdaptor struct {
// contains filtered or unexported fields
}
func NewNeuroskyAdaptor ¶
func NewNeuroskyAdaptor(name string, port string) *NeuroskyAdaptor
NewNeuroskyAdaptor creates a neurosky adaptor with specified name
func (*NeuroskyAdaptor) Connect ¶
func (n *NeuroskyAdaptor) Connect() (errs []error)
Connect returns true if connection to device is successful
func (*NeuroskyAdaptor) Finalize ¶
func (n *NeuroskyAdaptor) Finalize() (errs []error)
Finalize returns true if device finalization is successful
func (*NeuroskyAdaptor) Name ¶
func (n *NeuroskyAdaptor) Name() string
func (*NeuroskyAdaptor) Port ¶
func (n *NeuroskyAdaptor) Port() string
type NeuroskyDriver ¶
func NewNeuroskyDriver ¶
func NewNeuroskyDriver(a *NeuroskyAdaptor, name string) *NeuroskyDriver
NewNeuroskyDriver creates a NeuroskyDriver by name and adds the following events:
extended - user's current extended level signal - shows signal strength attention - user's current attention level meditation - user's current meditation level blink - user's current blink level wave - shows wave data eeg - showing eeg data
func (*NeuroskyDriver) Connection ¶
func (n *NeuroskyDriver) Connection() gobot.Connection
func (*NeuroskyDriver) Halt ¶
func (n *NeuroskyDriver) Halt() (errs []error)
Halt stops neurosky driver (void)
func (*NeuroskyDriver) Name ¶
func (n *NeuroskyDriver) Name() string
func (*NeuroskyDriver) Start ¶
func (n *NeuroskyDriver) Start() (errs []error)
Start creates a go routine to listen from serial port and parse buffer readings