For the wiring (power and ground excluded from the diagram, I'm assuming I figured that out correctly), I have the "A1" pin(?) on the Gemma hooked up to the "TX" pin(?) on the Bluefruit, and the "A2" pin(?) on the Gemma hooked up to the "RX" pin on the Bluefruit:
Code: Select all
+--------------------------------+
| |
| +-----------------------+ |
| | | USB IN | | |
| | | |
| | GEMMA | |
| | | |
| | +-------+ +-------+ | |
+----| | A1/D2 | | GRND | | |
| +-------+ +-------+ | |
| | |
| +-------+ +-------+ | |
+----| | A2/D0 | | D1/A0 | | |
| | +-------+ +-------+ | |
| | | |
| | +-------+ +-------+ | |
| | | 3Vo | | VOUT | | |
| | +-------+ +-------+ | |
| | | |
| | | USB IN | | |
| +-----------------------+ |
| |
| +-----------------------+ |
| | FLORA BLUEFRUIT | |
| | | |
| | +-------+ +-------+ | |
| | | MODE | | 3.3v | | |
| | +-------+ +-------+ | |
| | | |
| | +-------+ +-------+ | |
| | | GRND | | TX -------+
| | +-------+ +-------+ |
| | |
| | +-------+ |
| | | RX | |
| | +---|---+ |
| +----------|------------+
| |
+---------------+
Code: Select all
#include <Arduino.h>
#include <SPI.h>
#include "Adafruit_BLE.h"
#include "Adafruit_BluefruitLE_SPI.h"
#include "Adafruit_BluefruitLE_UART.h"
Adafruit_BluefruitLE_UART ble(Serial1, 12);
unsigned long previous = 0;
void setup(void) {
while (!Serial) {
delay(100);
}
if (ble.begin(true)) {
Serial.println("[bluetooth] ready");
} else {
Serial.println("[bluetooth] failed");
while (true) {
Serial.println("[bluetooth] failed boot, looping forever");
delay(1000);
}
}
if (ble.factoryReset()) {
Serial.println("[bluetooth] reset success");
} else {
Serial.println("[bluetooth] reset failed");
}
Serial.println("[bluetooth] ble ready, configuring");
ble.info();
ble.echo(false);
ble.verbose(false);
}
void loop(void) {
unsigned long current = millis();
if (current - previous < 250) {
return;
}
previous = current;
if (ble.isConnected() != true) {
Serial.println("[bluetooth] not connected");
return;
}
Serial.println("[bluetooth] connection established");
int message = ble.read();
switch (message) {
case -1:
Serial.println("no message");
break;
default:
Serial.println("has message");
break;
}
previous = current;
}
Code: Select all
[bluetooth] ready
[bluetooth] reset success
[bluetooth] ble ready, configuring
Code: Select all
[bluetooth] not connected
Code: Select all
[bluetooth] connection established
no message
1. sending text strings using the "UART" UI
2. clicking some of the buttons in the "Controller" -> "Control Pad" UI
Is there something obviously wrong with this setup?
Thank you!
P.S - By trade I've only ever worked with software on web applications, so my electrical engineering knowledge is very limited; I apologize if I'm not even making sense.