Default Pinout
In order to follow along with the default tutorial wiring, the Bluefruit LE SPI Friend should be connected to your Uno or Metro board using the following pins:
Bluefruit LE SPI Friend SCK VIN |
Metro/Uno 13 5V |
We'll be using hardware serial by default, that uses the UNO's hardware pins #13, #12 and #11. You can also use software SPI so you don't have to locate the hardware SPI pins!
Changing the Default Pinout
The examples sketches all assume the above pinouts by default. If you wish to change the location of the CS, IRQ or RST pins, open the BluefruitConfig.h file in the example folder, and change the pin to an appropriate value (See the Software section of this tutorial for instructions on installing the library):
#define BLUEFRUIT_SPI_CS 8 #define BLUEFRUIT_SPI_IRQ 7 #define BLUEFRUIT_SPI_RST 4
If you want to use software (bitbang) SPI, you can change the SCK, MISO and MOSI pins using the following macros in the same file:
#define BLUEFRUIT_SPI_SCK 13 #define BLUEFRUIT_SPI_MISO 12 #define BLUEFRUIT_SPI_MOSI 11
The BluefruitConfig.h file can be found in a dedicated tab, as shown below:
For all the example code, we have at the top of the sketch a few different ways you can communicate with the Bluefruit LE: hardware serial, software serial, hardware SPI and software SPI.
For the SPI Bluefruit, you cannot use serial. However, you can choose between hardware and software SPI.
If you want to use hardware SPI, uncomment this chunk of code (and comment out the other three options)
/* ...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 you want to use software/bitbang SPI, uncomment the following definition. You can then use any 6 pins (or 5, if you dont want to use RST)
/* ...software SPI, using SCK/MOSI/MISO user-defined SPI pins and then user selected CS/IRQ/RST */ Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_SCK, BLUEFRUIT_SPI_MISO, BLUEFRUIT_SPI_MOSI, BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);
Text editor powered by tinymce.