Closed aarontabor closed 7 years ago
Just tried running this project on a lab desktop. Since this computer has more than one serial device connected, the project wouldn't work unless I explicitly specified the serial port to use. In my case:
myoEmg = new MyoEMG(this, "COM3");
Not sure if we can know before-hand which port number the armband will be assigned. Maybe our best option is to iterate through all available serial ports and attempt a connection, moving on to the next after a timeout.
The MyoEMG
class now auto-detects the correct serial port by sending discovery requests across all available serial ports and waiting for the armband to reply.
This change was added in 7b63d4e
The Myo armband's bluetooth dongle presents itself to the computer as a serial device. Currently, the project simply assumes that the first serial device listed is the bluetooth dongle, which is a naive approach.
While this hasn't been a problem yet (I've never had more than a single serial device connected at once), in general this could be problematic and a more intelligent selection approach should be taken. This will probably become a problem when the bluetooth dongle and MyoBoy are connected simultaneously.