Rustymind is a driver and parser for NeuroSky MindWave EGG headset written in pure Rust. You can use it to connect, interact, and plot real time data from the headset.
The parser is based on the mindwave mindset communication protocols published by Neurosky.
See below for a screenshot of real time mindwaves plotted by rustymind-plot
CLI based on rustymind
parser.
rustymind-plot
takes two arguments to run:
/dev/tty.MindWave
.sh
cargo run --bin rustymind-plot "/dev/tty.MindWave" a05f
If you don't pass in the headset ID argument, the dongle will auto-connect to any headsets it can find.
To use rustymind
as a library, you need to use connect_headset
function and Parser
struct. For example:
```rust use rustymind::{connectheadset, PacketType, Parser, HEADSETIDAUTOCONNECT};
let mut port = connect_headset("/dev/tty.MindWave", b"\xa0\x5f")?;
let mut temp: Vec
loop { let bytebuf = port.read(temp.asmutslice()).unwrap(); for i in 0..bytebuf { if let Some(x) = parser.parse(temp[i]) { for r in x { match r { PacketType::Attention(value) => { println!("Attention value = {}", value); } PacketType::Meditation(value) => { println!("Meditation value = {}", value); } PacketType::AsicEgg(value) => { println!("EGG power values = {:?}", value); } _ => (), } } } } } ```