Focus Widget: questions on COM Port errors / values sent by widget
I have been recently working with the OpenBCI_GUI processing source code to try and achieve sending data/ values to external hardware via serial/COM port in a windows 10 environment. The networking widget of the GUI works fine and appears to be able to establish a link with an arduino I have connected to the same computer. An issue arises however when I try to link the output value from the Focus widget to the same COM port. I continuously receive "serial not present, search 'serial_output' in OpenBCI.pde and check serial settings." I changed the serial_output to my desired COM port first thing and that appears to a have achieved very little.




Any advice on fixing this?





Comments
// Focus Widget Blink
// Tested 3/31/2018 using iMac, Genuine Arduino, OpenBCI_GUI 3.2.0, and Max 7 by R. Waltman
int serialvalue = 0; // value for serial input
int started = 0; // flag for whether we've received serial yet
void setup()
{
Serial.begin(115200); // open the arduino serial port
// initialize digital pin 2 as an output.
pinMode(2, OUTPUT);
}
void loop()
{
if(Serial.available()) // check to see if there's serial data in the buffer
{
serialvalue = Serial.read(); // read a byte of serial data
started = 1; // set the started flag to on
}
else
{
serialvalue = 0;
started = 0;
}
if(started) // loop once serial data has been received
{
//if the value is 1 (focused), turn on the onboard LED/pin 2
if(serialvalue>=1){
digitalWrite(2, HIGH);
}
//if the value is 0 (not focused), turn off the onboard LED/pin 2
else if(serialvalue==0) {
digitalWrite(2, LOW);
}
}
}