Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Bluefruit Connect "Neopixels" control <--> UART Friend on UN
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Bluefruit Connect "Neopixels" control <--> UART Friend on UN

by briggsm on Fri Jul 03, 2020 9:09 am

This is my setup & observations:

    Arduino UNO
    Adafruit Bluefruit LE UART Friend
    NeoPixel 8x8 Matrix (is connected to Arduino, but not important to this question/post)
    Bluefruit Connect for iOS

Arduino UNO -> BLE UART Friend wiring is the default:

    MOD to Pin 12
    CTS to Pin 11
    TXO to Pin 10
    RXI to Pin 9
    VIN to 5V
    RTS to Pin 8
    GND to GND

I'm using the latest libraries as of today:

    Adafruit BluefruitLE nRF51 - Version 1.9.6
    Adafruit NeoPixel - Version 1.5.0
    And the lastest version of the Bluefruit Connect for iOS app.

I'm starting with the base code from the examples: <File>, <Examples>, <Adafruit BluefruitLE nRF51>, <neopixel>

In "BluefruitConfig.h", I only changed: BLUEFRUIT_UART_RTS_PIN from -1 to 8

In "neopixel.ino", I commented out SPI, and uncommented Software Serial lines.

Running with the code like this, everything sets up fine, and I can successfully connect to it via Bluefruit Connect for iOS. But the "Neopixels" control (in the Bluefruit Connect app) does not connect to the Arduino code (always says: "Status: Not detected"). Also using the UART control in the app, nothing appeared to reach the code running on the Arduino.

By debugging, I managed to find a hack/workaround, but I still can't figure out what's the root issue & how best to fix it. Here's what I managed to find:

If I add something like:
while ( !ble.available() ) { delay(10); }
before EVERY ble.read(), it works.

I even tried:
while ( !ble.available() ) { Serial.print("w"); delay(10); }
and nearly all of the time 0 w's are printed. So it's as if "ble.available()" must be called in order for "ble.read()" to work properly. Is this expected/normal behavior for Software Serial talking to a BLE UART Friend?

I also tried:
Code: Select all | TOGGLE FULL SIZE
while ( !ble.available() ) {delay(10); }
c = ble.read();  // This was successful
delay(1000);
c = ble.read();  // This was unsuccessful, even though there was more than 1 byte of data sent. Only if I add "ble.available()" before this call, then it works.


Any thoughts? Why is this happening and what should I do to "properly" fix it? And/or should anything be fixed in the example code? Thanks for any guidance that you can give!

briggsm
 
Posts: 44
Joined: Thu Oct 24, 2013 11:17 am

Please be positive and constructive with your questions and comments.


cron