Using Bluetooth in the arduino IDE?

Moderators: lily.li, violet, jessie, chao.zhang

Post Reply
josealb55
Pre-kindergarten
Pre-kindergarten
Posts: 3
Joined: Thu Mar 17, 2016 5:40 am

Using Bluetooth in the arduino IDE?

Post by josealb55 » Thu Mar 17, 2016 5:44 am

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!

jinyuan.weng
Pre-kindergarten
Pre-kindergarten
Posts: 33
Joined: Tue Jan 26, 2016 5:17 pm

Re: Using Bluetooth in the arduino IDE?

Post by jinyuan.weng » Thu Mar 17, 2016 4:08 pm

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

ASHTONMARKSON
Pre-kindergarten
Pre-kindergarten
Posts: 7
Joined: Sun Mar 27, 2016 4:31 am

Re: Using Bluetooth in the arduino IDE?

Post by ASHTONMARKSON » Mon Mar 28, 2016 12:08 am

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.

ASHTONMARKSON
Pre-kindergarten
Pre-kindergarten
Posts: 7
Joined: Sun Mar 27, 2016 4:31 am

Re: Using Bluetooth in the arduino IDE?

Post by ASHTONMARKSON » Tue Mar 29, 2016 10:15 pm

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.

Post Reply