Code: Select all
void setup(void)
{
pinMode(ledFlash, OUTPUT); // If declared here the LED works !!
digitalWrite( ledFlash, HIGH);
Serial.begin(9600);
Serial.println(F("Adafruit Bluefruit Command <-> Data Mode Example"));
Serial.println(F("------------------------------------------------"));
Serial.print(F("Initialising the Bluefruit LE module: "));
if ( !ble.begin(VERBOSE_MODE) ) // Start the BLE module.
{
error(F("Couldn't find Bluefruit, make sure it's in CoMmanD mode & check wiring?"));
}
Serial.println( F("OK!") );
ble.echo(false);
Serial.println("Requesting Bluefruit info:");
ble.info();
Serial.println(F("Please use Adafruit Bluefruit LE app to connect in UART mode"));
Serial.println(F("Then Enter characters to send to Bluefruit"));
Serial.println();
ble.verbose(false);
while (! ble.isConnected())
{
delay(500);
}
Serial.println(F("******************************"));
if ( ble.isVersionAtLeast(MINIMUM_FIRMWARE_VERSION) )
{
Serial.println(F("Change LED activity to " MODE_LED_BEHAVIOUR));
ble.sendCommandCheckOK("AT+HWModeLED=" MODE_LED_BEHAVIOUR);
}
Serial.println( F("Switching to DATA mode!") );
ble.setMode(BLUEFRUIT_MODE_DATA);
Serial.println(F("******************************"));
//pinMode(ledFlash, OUTPUT); // If declared here, LED does not work !!
//digitalWrite( ledFlash, HIGH);
}