Go Down

Topic: BLE peripheral: loop() stops when a connection happens (Read 1 time) previous topic - next topic

xenos76

Hi,
I'm trying to figure out how to use arduinoBLE library to switch the animation on a Neopixel strip.
I have successfully uploaded the BLE peripheral led service example on my MKR WIFI 1010.

I'm also trying to "ditch the delay()" as suggested by this tutorial:
https://learn.adafruit.com/multi-tasking-the-arduino-part-3

My idea was to extend the BLE service in order to switch the Neopixel animations just uploading new values to a certain charateristic.

At the moment I'm working on this code:
https://pastebin.com/ZTktwvyN

I tried to extend the sample adding a couple of led update functions  just before the end of the loop()
When I reset the device, I can see the leds blinking as expected and the line "post update()" printed on console.

As soon as I connect my mobile to the peripheral, the loop() stops and, even if I'm able to update characteristic's values, the redFlash.Update() end greenFlash.Update() don't get executed anymore.

Since I don't have much experience with BT and BLE, could someone suggest if this is the right approach to follow to achieve my goal?

Is there any repository showing examples of advanced use of arduinoBLE?

Best regards





xenos76

So, I kinda found an answer to my question.
Shame on me, having a further look at the examples showed up a "CallbackLED" sketch with a BLE.poll(); call in the loop()
That seems a non blocking option.


Regards

Go Up