gtec 0.0.2

Rust library and TUI for g.tec Unicorn Hybrid Black 8-channel EEG headset via the Unicorn C API (runtime-loaded)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Example: read 4 seconds of EEG data from a Unicorn.
use gtec::prelude::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
    env_logger::init();
    let serials = UnicornDevice::scan(true)?;
    if serials.is_empty() { eprintln!("No device found."); return Ok(()); }
    let mut device = UnicornDevice::open(&serials[0])?;
    println!("Connected: {:?}", device.device_info()?);
    let scans = device.capture(UNICORN_SAMPLING_RATE * 4)?;
    println!("Captured {} scans × {} channels", scans.len(), device.num_acquired_channels());
    device.close()?;
    Ok(())
}