EmotivBCI - Mental Commands Yes/No

Mental Commands yes/no example:

This flow allows you to use Mental Commands to express YES or NO as text and voice. After deploying the flow, open http://127.0.0.1:1880/ui on a new web browser tab to view the result.

How to import example:

To import this example to Node-RED:

  1. Start Node-RED in your Terminal or cmd window
  2. On your web-browser, go to http://127.0.0.1:1880 to open Node-RED
  3. On the top-right screen, go to Menu/Import/Clipboard and paste the contents of the JSON file below in "example directory".
  4. This examples require:
    On cmd/terminal, go to ~/.node-red and enter these commands (local install):
    a. EmotivBCI Node-RED Toolbox: npm install node-red-contrib-emotiv-emotiv-bci
    b. Node-RED dashboard: npm install node-red-dashboard

Since all BCI Node-Red flows and other Emotiv applications share one instance of Cortex Service, so you should only run/deploy one flow at a time.

[{"id":"d769a70a.980b78","type":"function","z":"eeda7784.3e2cd8","name":"Yes - Threshold 60","func":"var spoken = context.get('spoken') || false;\nvar threshold = 60;\nvar outString = \"yes\";\nvar outMsg = {payload: \"\", text : outString};\n\nif (!spoken) {\n    if (msg.payload >= threshold) {\n        outMsg.payload = outString;\n        spoken = true;\n    }\n}\n\nif (msg.payload < threshold) {\n    spoken = false;\n    outMsg.text = \"\";\n}\n\nconsole.log(outMsg);\n\ncontext.set('spoken', spoken);\nreturn outMsg;","outputs":1,"noerr":0,"x":770,"y":60,"wires":[["44c939c1.e4e3a8","622d1a57.250b94"]]},{"id":"33afa9c9.511c76","type":"function","z":"eeda7784.3e2cd8","name":"No - Threshold 60","func":"var spoken = context.get('spoken') || false;\nvar threshold = 60;\nvar outString = \"no\";\nvar outMsg = {payload: \"\", text : outString};\n\nif (!spoken) {\n    if (msg.payload >= threshold) {\n        outMsg.payload = outString;\n        spoken = true;\n    }\n}\n\nif (msg.payload < threshold) {\n    spoken = false;\n    outMsg.text = \"\";\n}\n\ncontext.set('spoken', spoken);\nreturn outMsg;","outputs":1,"noerr":0,"x":770,"y":180,"wires":[["44c939c1.e4e3a8","622d1a57.250b94"]]},{"id":"44c939c1.e4e3a8","type":"ui_text","z":"eeda7784.3e2cd8","group":"fea83661.1ab498","order":0,"width":0,"height":0,"name":"","label":"Text Response","format":"{{msg.text}}","layout":"row-spread","x":1040,"y":60,"wires":[]},{"id":"622d1a57.250b94","type":"ui_audio","z":"eeda7784.3e2cd8","name":"Voice Response","group":"fea83661.1ab498","voice":"en-US","always":"","x":1040,"y":180,"wires":[]},{"id":"7a2816bd.f70c08","type":"EMOTIV","z":"eeda7784.3e2cd8","name":"EMOTIV","x":80,"y":180,"wires":[["d82d6a78.fff4f8"]]},{"id":"d82d6a78.fff4f8","type":"Profile-Name","z":"eeda7784.3e2cd8","name":"Profile Name","profileName":"","x":260,"y":120,"wires":[["6af191cb.71c66","d309717a.21006"]]},{"id":"6af191cb.71c66","type":"Mental-Command","z":"eeda7784.3e2cd8","name":"Mental Commands","actionName":"push","mcSen":"10","x":490,"y":60,"wires":[["d769a70a.980b78"]]},{"id":"d309717a.21006","type":"Mental-Command","z":"eeda7784.3e2cd8","name":"Mental Commands","actionName":"pull","mcSen":"10","x":490,"y":180,"wires":[["33afa9c9.511c76"]]},{"id":"fea83661.1ab498","type":"ui_group","name":"Group 1","tab":"d7908651.24f9b8","order":1,"disp":true,"width":6},{"id":"d7908651.24f9b8","type":"ui_tab","name":"Tab 1","icon":"dashboard","order":1}]

Flow Info

Created 2 years, 5 months ago
Updated 2 years, 4 months ago
Rating: not yet rated

Owner

Node Types

Core
  • function (x2)
Other

Tags

  • emotiv
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option