function detectMind(volts) {

    const options = {mode: "text"};
    let pyshell = new PythonShell("/src/pyscripts/mindDetect.py", options);
    let data = JSON.stringify(volts);

    // sends channel data to the Python script via stdin
    pyshell.send(data).end(function (err) {
        if (err) {
            console.log("pyshell send err: " + err)
        }
    });

    // received a message sent from the Python script (a simple "print" statement)
    pyshell.stdout.on("data", function (data) {
        // Remove all new lines
        doMindcommand = data.replace(/\r?\n|\r/g, "");
    });

    // end the input stream and allow the process to exit
    pyshell.end(function (err) {
        if (err) {
           throw err;
        }
        //process python result, send cmd if detected
        if (doMindcommand !== "nop") {
            console.log("doMindcommand was not nop:" + doMindcommand);
            //send doCommand to execute
            server.doMindCmd(doMindcommand);
        }
    });
}
/**
 * call python script to detect mind controls
 * @param eeg volts
 */
call python script to detect mind controls
@param eeg volts
call python script to detect mind controls @param eeg volts
function detectMind(volts) {
    const options = {mode: "text"};
    let pyshell = new PythonShell("/src/pyscripts/mindDetect.py", options);
    let data = JSON.stringify(volts);
    pyshell.send(data).end(function (err) {
        if (err) {
            console.log("pyshell send err: " + err)
        }
    });
    pyshell.stdout.on("data", function (data) {
        doMindcommand = data.replace(/\r?\n|\r/g, "");
    });
    pyshell.end(function (err) {
        if (err) {
           throw err;
        }
        if (doMindcommand !== "nop") {
            console.log("doMindcommand was not nop:" + doMindcommand);
            server.doMindCmd(doMindcommand);
        }
    });
}
function detectMind ( volts ) { const options = { mode : "text" } ; let pyshell = new PythonShell ( "/src/pyscripts/mindDetect.py" , options ) ; let data = JSON . stringify ( volts ) ; pyshell . send ( data ) . end ( function ( err ) { if ( err ) { console . log ( "pyshell send err: " + err ) } } ) ; pyshell . stdout . on ( "data" , function ( data ) { doMindcommand = data . replace ( / \r?\n|\r / g , "" ) ; } ) ; pyshell . end ( function ( err ) { if ( err ) { throw err ; } if ( doMindcommand !== "nop" ) { console . log ( "doMindcommand was not nop:" + doMindcommand ) ; server . doMindCmd ( doMindcommand ) ; } } ) ; }
call python script to detect mind controls
 @param eeg volts
call python script to detect mind controls @param eeg volts
// sends channel data to the Python script via stdin // received a message sent from the Python script (a simple "print" statement) // Remove all new lines // end the input stream and allow the process to exit //process python result, send cmd if detected //send doCommand to execute