Bluetooth communication from Windows to android phone

  • Replies:0
Greg Boyles
  • Forum posts: 6

Mar 3, 2016, 2:40:13 PM via Website

Using Visual Studio 2010 and an Arduino with a HC-05 module, I have successfully communicated between the two with simple text.

In Visual Studio it is through a API file handle connected to a com port, i.e. I simply iterate through com ports 1 - 50, try and open it via an API open file function call, if successful I send the string "ARDUINO" and if the arduino is connected through this com port number then it responds with "PAGER1" etc.

As it turned out I don't need to first pair with the HC-05/Arduino in Windows bluetooth stack manager before attempting to communicate with it from Windows...which was rather convenient.

Now I would like to replicate this with an android phone in place of the arduino.

I have gotten this far with my android studio script:

 @Override
public void onSart()
{
    super.onSart();

    m_Bluetooth = BluetoothAdapter.getDefaultAdapter();
    m_bBlueToothOnAtStart = m_Bluetooth.isEnabled();
    if (!m_Bluetooth.isEnabled())
    {
        Intent TurnOn = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
        startActivityForResult(TurnOn, 0);
    }
}

But I am unsure how to proceed. I have not been able to find any suitable examples.

Reply