RaspberryPi Pico HC-06- bluetooth app doesn't send data to HC-06

Hi! I am trying to blink an LED from MIT bluetooth app -> HC-06 connected to RaspberryPi Pico.
Here's the code from both the ends, the MIT app connects to the bluetooth HC-06 but no data is sent to Pico.
I tested the Pico HC-06 setup through another serial-bluetooth-app on android and that blinks the LED.

Can someone please help with what's going wrong here?

Hello Dipali

The snag is that via App Inventor Apps, Arduino is the most popular microcontroller family to work with, hence there is very little information about working with AI and Pi.

When an App Inventor App sends data via BT, how that data is collected and processed is entirely covered by the micro-controller's Script (known as a Sketch in the Arduino world).

If as you say, you have verified that a BT connection has been made, then the data ("C") should reach the Pi, but you have actually not got a connection.

There is a flaw in your App code where you have the [ListPicker Selection] being set by the [call BluetoothClient] function.

I attach a basic example Project that should prove if there is a connection and if so send text data ("Hello") on button click. I suggest you try this (change "Hello" to "C") and see if the Pi receives the data. If it does, you can modify the example as required or copy Blocks from it into your own Project (via the BackPack).

BT_Basic_Setup_Send.aia (7.1 KB)

1 Like

Thank you Chris! I tried the app you sent, it gives the same result - the connection is established but nothing happens on button click. There is no data sent to bluetooth (uart is empty).
While when I use another serial communication app with HC-06 on RaspberryPi Pico- communication is flawless, here's the display of data received from another serial communication app from my android - so I know the Pico microPython side works. I hv been trying to get MIT app to work for two weeks, have tried different baud rates, different UART channels.
Sample screenshot of RaspberryPi Pico- HC06 receiving data well from another android app:

Best,
Dipali

Here is a hunch to try ...

Send these text blocks from your AI2 app:
text (1)
text

P.S. These blocks can be dragged directly into your Blocks Editor workspace.

See A way to group projects by theme - #10 by ABG
for a demo.

1 Like

Yes sending '1\r\n' from AI2 app made it work! Thanks so much ABG! Appreciate your quick response!!!

Best,
Dipali

Thanks for letting us know it worked!

1 Like

That's great news Dipali, thanks for letting us know. Good luck with your Project.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.