Using Bluetooth in the arduino IDE?

Hello,

We have tested toggling the GPIOs though SMS which worked fine.

Now we would like to control them through an Android/iOS App via Bluetooth but we didn’t find any examples on how to connect to a device using the Arduino IDE. I searched the Github and I see there is bluetooth support, I just don’t know how to use it.

Also, do you know of any examples of the mobile app?

Thanks!

Hi,
Maybe you can make reference to …\Arduino_IDE_for_RePhone\hardware\arduino\mtk\libraries\LBT.

I can’t get the examples to work. Has someone successfully done a walk through? I tried both the client and server .ino files. They compile ok, but there is nothing coming on the serial console and no Bluetooth devices are discoverable by my BT sniffer.

I’ll post my continued findings here…

after some debugging I find that despite:

 bool success = LBTServer.begin((uint8_t*)SPP_SVR); 

returning true,

 if(LBTServer.available()) 

is always false.

Further, when I comment the majority of the loop method out, the loop does in fact run and I do so the device on my phone.
(I’m using light blue’s BT tracker, it’s very useful)

After looking at the example code on GIT, I see a line:

bool connected = LBTServer.accept(1800);

Which I don’t believe is in the download/example that I have. I’ll have to check later.

Also, I’d love an explanations of why loop() is setting sent to 1. It seems that it will prevent the BT magic from happening more than once.

I am also wondering how I can test this with the tools I have. I assume I can just write to the buffer and see the value on my phone, and likewise write a value on my phone and see it in the console. I’m also wondering how to add values/attributes to the connection.