import "gobot.io/x/gobot/platforms/neurosky"
Package neurosky contains the Gobot adaptor and driver for the Neurosky Mindwave Mobile EEG.
Installing:
go get gobot.io/x/gobot/platforms/neurosky
Example:
package main import ( "fmt" "gobot.io/x/gobot" "gobot.io/x/gobot/platforms/neurosky" ) func main() { adaptor := neurosky.NewAdaptor("/dev/rfcomm0") neuro := neurosky.NewDriver(adaptor) work := func() { neuro.On(neuro.Event("extended"), func(data interface{}) { fmt.Println("Extended", data) }) neuro.On(neuro.Event("signal"), func(data interface{}) { fmt.Println("Signal", data) }) neuro.On(neuro.Event("attention"), func(data interface{}) { fmt.Println("Attention", data) }) neuro.On(neuro.Event("meditation"), func(data interface{}) { fmt.Println("Meditation", data) }) neuro.On(neuro.Event("blink"), func(data interface{}) { fmt.Println("Blink", data) }) neuro.On(neuro.Event("wave"), func(data interface{}) { fmt.Println("Wave", data) }) neuro.On(neuro.Event("eeg"), func(data interface{}) { eeg := data.(neurosky.EEGData) 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, ) robot.Start() }
For further information refer to neuroky README: https://github.com/hybridgroup/gobot/blob/master/platforms/neurosky/README.md
Package neurosky is the Gobot platform for the Neurosky Mindwave EEG
doc.go neurosky_adaptor.go neurosky_driver.go
const ( // BTSync is the sync code BTSync byte = 0xAA // CodeEx Extended code CodeEx byte = 0x55 // CodeSignalQuality POOR_SIGNAL quality 0-255 CodeSignalQuality byte = 0x02 // CodeAttention ATTENTION eSense 0-100 CodeAttention byte = 0x04 // CodeMeditation MEDITATION eSense 0-100 CodeMeditation byte = 0x05 // CodeBlink BLINK strength 0-255 CodeBlink byte = 0x16 // CodeWave RAW wave value: 2-byte big-endian 2s-complement CodeWave byte = 0x80 // CodeAsicEEG ASIC EEG POWER 8 3-byte big-endian integers CodeAsicEEG byte = 0x83 // Extended event Extended = "extended" // Signal event Signal = "signal" // Attention event Attention = "attention" // Meditation event Meditation = "meditation" // Blink event Blink = "blink" // Wave event Wave = "wave" // EEG event EEG = "eeg" // Error event Error = "error" )
type Adaptor struct {
// contains filtered or unexported fields
}
Adaptor is the Gobot Adaptor for the Neurosky Mindwave
NewAdaptor creates a neurosky adaptor with specified port
Connect returns true if connection to device is successful
Finalize returns true if device finalization is successful
Name returns the Adaptor Name
Port returns the Adaptor port
SetName sets the Adaptor Name
Driver is the Gobot Driver for the Mindwave
NewDriver creates a Neurosky Driver 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 (n *Driver) Connection() gobot.Connection
Connection returns the Driver's connection
Halt stops neurosky driver (void)
Name returns the Driver name
SetName sets the Driver name
Start creates a go routine to listen from serial port and parse buffer readings
type EEGData struct { Delta int Theta int LoAlpha int HiAlpha int LoBeta int HiBeta int LoGamma int MidGamma int }
EEGData is the EEG raw data returned from the Mindwave
Package neurosky imports 4 packages (graph) and is imported by 1 packages. Updated 2020-12-06. Refresh now. Tools for package owners.