Page 1 of 1

Using Bluetooth in the arduino IDE?

Posted: Thu Mar 17, 2016 5:44 am
by josealb55
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!

Re: Using Bluetooth in the arduino IDE?

Posted: Thu Mar 17, 2016 4:08 pm
by jinyuan.weng
Hi,
Maybe you can make reference to ...\Arduino_IDE_for_RePhone\hardware\arduino\mtk\libraries\LBT.

Re: Using Bluetooth in the arduino IDE?

Posted: Mon Mar 28, 2016 12:08 am
by ASHTONMARKSON
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.

Re: Using Bluetooth in the arduino IDE?

Posted: Tue Mar 29, 2016 10:15 pm
by ASHTONMARKSON
I'll post my continued findings here....

after some debugging I find that despite:

Code: Select all

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

Code: Select all

 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:

Code: Select all

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.