Skip to content

Quick Start

Quick Start

A minimal example to start a data collection session:

from pymindwave2 import MindWaveMobile2, Session, SessionConfig

# Initialize and connect to the headset
headset = MindWaveMobile2()
success = headset.start(n_tries=5, timeout=30)

if success:  # if the headset is connected successfully
    # Create a session configuration
    sess_config = SessionConfig(
        user_name="Ahmed",
        ...  # other configurations
        classes=["left", "right"]
    )

    # Initialize and start the recording session
    session = Session(headset, config=sess_config)
    session.start()  # Start recording data

    while session.is_active:
        pass  # wait for the session to finish

    session.save()  # save the recorded data to disk

for more examples and detailed usage, check the Examples