arduino-libraries / WiFiNINA

140 stars 106 forks source link

Can't use RGB Led when using BLE on MKR1010 #141

Open mcxiv opened 3 years ago

mcxiv commented 3 years ago

Hi everyone,

Tested on Arduino MKR 1010

Following the issue #24 , I tried to control the RGB Led, while connected to a BLE device.

Using a bit of Example/ArduinoBLE/Peripheral/ButtonLED

Unfortunately, it didn't work. As I'm kinda newbee to Github, I don't know how to post a longer piece of code... Sososorry.

If we use

WiFiDrv::digitalWrite(25, HIGH);

before

BLE.begin()

it works perfectly, but if we use it after, it doesn't work and it's blocking our program.

mcxiv commented 3 years ago

Hi,

After going a little bit further into that problem, I though that rebooting the BLE service would do the job.

It doesn't. Adding :

BLE.stopScan();
BLE.end();
for(int y = 1; y <= 254; y++){
      WiFiDrv::analogWrite(26, y);
      delay(1);
 }

for(int y = 254; y >= 0; y--){
      WiFiDrv::analogWrite(26, y);
      delay(1);
}
BLE.begin();
BLE.scan(0);
Serial.println("it works");

Well, it never reaches "it works", and the RGB Led doesn't light up.

Maybe it's link with the fact that the MKR1010 can't use BLE and WIFI simultaneously ?

mcxiv commented 3 years ago

https://github.com/arduino-libraries/ArduinoBLE/issues/3#issuecomment-445912224

That explains.

andewx commented 11 months ago

Thanks I was having this same error and never able to even see that it was the BLE causing the issue. Documentation needs to state this!