Locally control D7 Led from any App


#1

Hi Everyone,
I am new to work with this.
I am trying to control the Bluz D7 led with the data I will send through the local ble Apps. I have gone through many posts on forum and I have seen one service i.e. custom_data_service from which you can send the data to bluz locally. I run the application and when I am sending the data format 0x04+data+0x0304 through ble (eg. ble scanner App or nrf connect app) nothing is happing.

Please help me!

Thanks! :slight_smile:


#2

Bluz requires you to send 0x04+data and then send a separate packet with 0x03, 0x04. So you would have to send data twice from the app, this may be a little tricky.

We hadn’t anticipated using other apps with bluz, so I don’t know how easy/hard this would be. I sounds like this is becoming a feature others would like as well, so it is something I am planning to add the the bluz app.

Just out of curiosity, is there a ready you don’t want to use the Particle cloud? Using the Particle app, you can call functions, check variables, etc. from the phone. This works today, and is much more secure than using local communication. Is that not sufficient for your application?


#3

Hi @eric, I am successfully able to send data to bluz from any App. Thank you so much for your instructions. :slight_smile:
I want to send some specific data to bluz to glow the led but what happening here is: led is glowing by sending any kind of data. PLease tell me where to specify the data.

Thanks again :slight_smile:


#4

Hi @eric,
I am successfully able to send the specific data also. I have defined in custom_data_service(function= datacallbackhandler):
> if (*data == 1)

        {
        digitalwrite(D7, HIGH);
        }

Thanks for your guidance :slight_smile:


#5

Hi @eric,

One more issue is occurring now when I’m sending the data locally:

As I send the data for the first time, the data goes down to bluz and D7 blinks but the connection gets terminated so I’m not able to send the data further otherwise I need to connect again and again, the no. of times I want to send the data and the code is also not completely executing.

eg:
If (*data ==1)
{
DigitalWrite(D7, HIGH);
delay(10000);
DigitalWrite(D0, HIGH);
}
In this particular code, When I’m sending the data, D7 gets high but after D7, connection terminates and the code stop executes so D0 led doesn’t glow.

Please help me to resolve this problem.
Thanks :slight_smile:


#6

I think, the issue is with delay only. Because when I am providing delay of 10 sec then connection gets auto-terminated and when I’m providing the delay of 1 sec, the device remains connected. And it is happening only in local communication. :sweat: Because for cloud communication, Everything is working perfectly.

Please tell me the issue why it is occurring in local communication?

I want both communications (local as well as cloud) because suppose if I’m not having internet facility then how will I access my device so for that I want local communication.


#7

I believe the instructions in the other thread should work for you. In the end, it could be a problem with the app, it could disconnect the device for various reasons.

We will be adding the ability to do this to our app soon, so I hope that helps in the long term.

Thanks


#8

Everything is working fine now. @fbtobajas’s tutorial helped me a lot in resolving all the issues. Thanks @eric