How to know which COM to use. C# & Bluetooth -


so have connection arduino using bluetooth card. right have com hard coded c# , arduino doesn't set or choose com. question is, assume distributed product. how know arduino connect com? there way scan coms specific item use connection param? here sample code of doing give idea.

        serialport bluetoothconnection = new serialport();          bluetoothconnection.baudrate = (9600);          bluetoothconnection.portname = "com3";          bluetoothconnection.open(); 

this code working can see com3 hard coded... no distribution

also basic example given when google c# , bluetooth connections no there.

possible options are:

  • provide runtime selection of com port (some settings dialog)
  • enter actual com-port in app.config (use .net configuration model or custom xml)
  • try open available com ports (serialport.getportnames()) , attempt communicate device

you cannot guarantee device connected com port because depends on os specific setting (is there com3 @ all?) , user specific settings (user may choose on of several com ports)


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -