software problem with BLE controller example

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
peterprbrtsn
 
Posts: 5
Joined: Tue Aug 22, 2017 2:13 pm

software problem with BLE controller example

Post by peterprbrtsn »

I'm using the nRF52840 express and Arduino IDE. My application is to be used outdoors or remotely. My problem is that it only pairs with iPad or iPhone when is pugged into my computer and running the IDE . It waits until I click on the serial monitor, the it pairs up and everything is OK. I'm only using the Button part of the example but does it even with the whole example.
Thanks, Pete

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: software problem with BLE controller example

Post by adafruit_support_mike »

Check your setup() function for something like this:

Code: Select all

	while ( ! Serial ) { delay( 1 ); }
It takes the microcontroller a few milliseconds to set up a USB Serial connection with the computer and initialize a Serial object. The code in setup() can run within microseconds of the chip booting though, and function calls like Serial.begin() fail silently if the Serial object hasn't been initialized yet. The code above makes sure you have a working Serial interface with the computer before it runs any more of your code.

When you unplug the board from the computer, it becomes impossible to create a Serial object, and the line above will hang forever. That's a common gotcha when using chips that handle USB internally.

Locked
Please be positive and constructive with your questions and comments.

Return to “Wireless: WiFi and Bluetooth”