1 Reply Latest reply on Mar 11, 2014 8:02 AM by Scott Murchison

    MC67 communicating with Arduino via bluetooth

    Scott Murchison

      I have been following the help file to work with the WPAN class to produce a program on my MC67 that will pair and exchange data with an Arduino based microcontroller. The sample app that comes with EMDK doesn't work reliably and is always giving me index out of range errors. While it can discover my Arduino, it can't seem to pair with it. Instead of discovering devices, I am trying to create a custom remote device. I need to use the SPP protocol and I am using the Microsoft stack. Part of my code looks something like this;


                  m_Bluetooth = new Bluetooth();





                  rd = new RemoteDevice("", "221302261057", "");


                  rd.LocalComPort = 5;



      Question: Do I need to specify Name and Service Name in the constructor. I can get the name, but I don't know what I would use for the Service Name

        • Re: MC67 communicating with Arduino via bluetooth
          Scott Murchison

          Problem solved. I added some debug code to my program to track what ports were available on the MC67 terminal. It started out as 5 and then, over time, it went down to zero. That’s when I had trouble. Resetting the terminal freed up the 5 ports again. My guess is that once paired, the terminal locks up a particular port until it is unpaired. My thinking is that it didn’t always unpair properly, or I wasn’t being careful enough to unpair my Bluetooth connection to my Arduino.

          The code below generates a simple string containing the ports available. It's not elaborately formatted, but it told me what i needed to know.

                      //see what local COM ports are available

                      for (int i = 0; i < m_Bluetooth.LocalComPorts.Length; i++)


                          s = s + m_Bluetooth.LocalComPorts[i];


                      statusBar1.Text = "Local Ports: " + s;