Currently, I have bought a bluetooth 3DR module for pixhawk to transfer telemetry data to an Android phone. I can connect to the device, i.e. The bluetooth module turns solid red. However, the Android program says that the phone and pixhawk are not connected. Here is my current connection setup.
protected void updateConnectedButton(Boolean isConnected) {
Button connectButton = (Button)findViewById(R.id.btnConnect);
connectButton.setText(isConnected ? "Disconnect" : "Connect");
}
public void onBtnConnectTap(View view) {
if(drone.isConnected()) {
drone.disconnect();
} else {
Bundle extraParams = new Bundle();
extraParams.putInt(ConnectionType.EXTRA_USB_BAUD_RATE, DEFAULT_USB_BAUD_RATE);
ConnectionParameter connectionParams = new ConnectionParameter(ConnectionType.TYPE_BLUETOOTH,extraParams,null);
drone.connect(connectionParams);
}
try {
Thread.sleep(8000);
} catch(InterruptedException e) {
}
updateConnectedButton(drone.isConnected());
}
If I delete the USB baud rate setting, the red light on the device continues to flash when I try to connect. I added sleep mode because it takes some time to connect the Bluetooth module. The documentation and examples do not talk about Bluetooth connections. Any ideas what I'm doing wrong?
source
share