Bluefruit LE Micro freezing in setup method
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- OwenMcGirr
- Posts: 5
- Joined: Thu Aug 27, 2015 6:48 am
Bluefruit LE Micro freezing in setup method
Hey. I am trying to use the micro for basic data transfer. I want to receive characters from an application I have created. Each character received will turn on and off a pin. Anyway that's not important. In my setup method I am setting the mode to BLUEFRUIT_MODE_DATA. After this the device seems to enter an infinite loop. The serial spits out lines of black diamonds with question marks. The firmware is 0.6.7. Any advice would be greatly appreciated.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Bluefruit LE Micro freezing in setup method
Make sure you have matching baud rates between the sketch and Serial MonitorOwenMcGirr wrote:The serial spits out lines of black diamonds with question marks.
- OwenMcGirr
- Posts: 5
- Joined: Thu Aug 27, 2015 6:48 am
Re: Bluefruit LE Micro freezing in setup method
115200 yeah they match
I should have also mentioned that pins 6 and 8 seem to go HIGH
I should have also mentioned that pins 6 and 8 seem to go HIGH
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Bluefruit LE Micro freezing in setup method
please post the code you're running
- OwenMcGirr
- Posts: 5
- Joined: Thu Aug 27, 2015 6:48 am
Re: Bluefruit LE Micro freezing in setup method
Code: Select all
#include <SPI.h>
#if not defined (_VARIANT_ARDUINO_DUE_X_) && not defined (_VARIANT_ARDUINO_ZERO_)
#include <SoftwareSerial.h>
#endif
#include "Adafruit_BLE.h"
#include "Adafruit_BluefruitLE_SPI.h"
#include "Adafruit_BluefruitLE_UART.h"
#include "BluetoothConfig.h"
// ble object
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);
// relay pins
const int relay1 = 4;
const int relay2 = 5;
const int relay3 = 6;
const int relay4 = 7;
const int relay5 = 8;
const int relay6 = 9;
void initRelays() {
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
pinMode(relay4, OUTPUT);
pinMode(relay5, OUTPUT);
pinMode(relay6, OUTPUT);
}
void setup(void) {
// wait for serial
while (!Serial);
// start serial
Serial.begin(9600);
// initialise relays
initRelays();
// start ble
if (!ble.begin(true)) {
Serial.println("Bluefruit not found!!!");
}
else {
Serial.println("Bluefruit found!!! BLE started!!!");
}
// set broadcast name
if (!ble.sendCommandCheckOK(F("AT+GAPDEVNAME=BLERelays"))) {
Serial.println("Could not set broadcast name!!!");
}
// disable verbose
ble.verbose(false);
// set mode
ble.setMode(BLUEFRUIT_MODE_DATA);
}
void loop(void) {
// constantly poll for data
while (ble.available()) {
int c = ble.read();
// convert to character
char action = (char)c;
// print action character
Serial.println(action);
// do action
switch (action) {
case 'A':
doRelayDown(relay1);
break;
case 'B':
doRelayDown(relay2);
break;
case 'C':
doRelayDown(relay3);
break;
case 'D':
doRelayDown(relay4);
break;
case 'E':
doRelayDown(relay5);
break;
case 'F':
doRelayDown(relay6);
break;
case 'G':
doRelayUp(relay1);
break;
case 'H':
doRelayUp(relay2);
break;
case 'I':
doRelayUp(relay3);
break;
case 'J':
doRelayUp(relay4);
break;
case 'K':
doRelayUp(relay5);
break;
case 'L':
doRelayUp(relay6);
break;
default:
break;
}
}
}
void doRelayDown(int r) {
digitalWrite(r, HIGH);
}
void doRelayUp(int r) {
digitalWrite(r, LOW);
}
- OwenMcGirr
- Posts: 5
- Joined: Thu Aug 27, 2015 6:48 am
Re: Bluefruit LE Micro freezing in setup method
I had it at 112500
Please be positive and constructive with your questions and comments.