Datasheet
Software SPI Pins
If you don't have a hardware SPI port available, you can use any three pins...its a tad slower but very flexible
// SOFTWARE SPI SETTINGS
#define BLUEFRUIT_SPI_SCK 13
#define BLUEFRUIT_SPI_MISO 12
#define BLUEFRUIT_SPI_MOSI 11
Select the Serial Bus
Once you've configured your pin setup in the BluefruitConfig.h file, you can now check and adapt the example sketch.
The Adafruit_BluefruitLE_nRF51 library supports four different serial bus options, depending on the HW you are using:
SPI both hardware and software type, and UART both hardware and software type.
UART Based Boards (Bluefruit LE UART Friend & Flora BLE)
This is for Bluefruit LE UART Friend & Flora BLE boards. You can use
either
software serial or hardware serial. Hardware
serial is higher quality, and less risky with respect to losing data. However, you may not have hardware serial available!
Software serial does work just fine with flow-control and we do have that available at the cost of a single GPIO pin.
For software serial (Arduino Uno, Adafruit Metro) you should uncomment the software serial contructor below, and
make sure the other three options (hardware serial & SPI) are commented out.
// Create the bluefruit object, either software serial...uncomment these lines
SoftwareSerial bluefruitSS = SoftwareSerial(BLUEFRUIT_SWUART_TXD_PIN, BLUEFRUIT_SWUART_RXD_PIN);
Adafruit_BluefruitLE_UART ble(bluefruitSS, BLUEFRUIT_UART_MODE_PIN,
BLUEFRUIT_UART_CTS_PIN, BLUEFRUIT_UART_RTS_PIN);
For boards that require hardware serial (Adafruit Flora, etc.), uncomment the hardware serial constructor, and make
sure the other three options are commented out
/* ...or hardware serial, which does not need the RTS/CTS pins. Uncomment this line */
Adafruit_BluefruitLE_UART ble(BLUEFRUIT_HWSERIAL_NAME, BLUEFRUIT_UART_MODE_PIN);
SPI Based Boards (Bluefruit LE SPI Friend)
For SPI based boards, you should uncomment the hardware SPI constructor below, making sure the other constructors
are commented out:
/* ...hardware SPI, using SCK/MOSI/MISO hardware SPI pins and then user selected CS/IRQ/RST */
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);
If for some reason you can't use HW SPI, you can switch to software mode to bit-bang the SPI transfers via the following
Refer to the table above to determine whether you have SPI or UART controlled Bluefruits!
© Adafruit Industries https://learn.adafruit.com/adafruit-feather-32u4-bluefruit-le Page 51 of 211










