Page 1 of 1

Using BLE to control multiple LEDs

Posted: Wed Nov 01, 2017 12:38 pm
by mflavoni
Hi everyone,

I am pretty new to BLE (and coding for that matter), and was looking at the project in the link below.

https://learn.sparkfun.com/tutorials/si ... energy-ble

I was able to get this working, but I was curious how the code would need to change if I wanted to control more than one LED. My first instinct would be to send different values for each LED to the arduino and use if statements to distinguish which LED I was looking to change, but I didn't know if you were able to send values other than 0 or 1 to the board. If someone could explain how I can go about doing this, that would be great.

Thanks.

Re: Using BLE to control multiple LEDs

Posted: Mon Nov 06, 2017 12:33 pm
by Valen
This image of Experiment 21 suggests that the value that is sent is a byte (argument).
Image
So yeah, that would mean it can count further than 1. What sort of other value types are available in the bluetooth/smartphone app is something you'll have to investigate in the documentation mentioned. The CurieBLE link suggests on that page that the maximum size of "a characteristic value can be up to 20 bytes long". So plenty of space if you can concatenate and decode your data in a systematic way.