Daten via Adafruit Bluefruit LE SPI(Bluetooth) senden fehlgeschlagen

Hi, möchte Daten die ich von einem Fio aus via XBEE S2 an dem Arduino UNO(inkl. Wireless SD Shield+XBEES2) sende mit Bluetooth anhand von dem Bluefruit LE SPI an das Smartphone senden.

Dabei habe ich mir folgendes Tutorial angeschaut: Introduction | Introducing the Adafruit Bluefruit LE SPI Friend | Adafruit Learning System besonders den Punkt BleUart und habe somit diesen Sketch an meine Bedürfnisse angepasst.

Nun habe ich dieses an den Arduino Uno geflasht und war mir ziemlich sicher, dass ich damit die empfangenen Daten via XBEE direkt über dem Bluetooth-Modul an das Smartphone senden konnte, doch sobald ich mich anhanf der Bleufruit LE APP mit dem Modul verbinde und auf Uart gehe kommt nichts an.

Habe alles Versucht und mehrmals mir das Tutorial angeschaut, doch jetzt bin ich an einem Punkt, wo ich nicht mehr weiterkomme.

Hier der Code:

include <Arduino.h>
#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 "BluefruitConfig.h"



/*------------------------Global variables-----------------------------*/
String receivedData="";
boolean stringComplete= false; //Flag if string is completely received
/*---------------------------------------------------------------------*/
 
// Create the bluefruit object, either software serial...uncomment these lines

/* ...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);
/**************************************************************************/
/*!
    @brief  Sets up the HW an the BLE module (this function is called
            automatically on startup)
*/
/**************************************************************************/
void setup(void)
{
  // put your setup code here, to run once:
  //Baudrate für XBEE-KOmmuikation & Bluetooth Module
  Serial.begin(9600);
  pinMode(13,OUTPUT); //Pin 13= integrated LED of Fio
  //reserve 200 bytes for receivedString
  receivedData.reserve(200);
  
  
  /* Wait for connection */
  while (! ble.isConnected())
  {
      delay(500);
  }
    // Set module to DATA mode
  Serial.println( F("Switching to DATA mode!") );
  ble.setMode(BLUEFRUIT_MODE_DATA);

 }//end fu

void loop(void)
{
  
   // put your main code here, to run repeatedly:
  serialEvent();
  if(stringComplete == true)
  {
    //send characters to Bluefruit module --> everything that comes on RX-Pin will reach Bluetooth module
    // Send characters to Bluefruit
    Serial.print("[Send] ");
    Serial.println(receivedData);

    ble.print("AT+BLEUARTTX=");
    ble.println(receivedData);

    //clear stringbuffer
    receivedData="";
    stringComplete=false; //reset flag again to false
  }//endif 
}//end loop

void serialEvent()
{
  while(Serial.available())
  {
    char inSign=(char)Serial.read();
    //add the read sign to the buffer & increment counter of buffer
    receivedData+=inSign;
    
    //when incoming character is "/n" set flag --> /n = sign that string ends
    if(inSign == '\n')
    {
      stringComplete=true; //flag = true
    }//endif
 }//end while   
}//end fu

Bitte um eine Hilfestellung bzw. kann mir jemand helfen?
Danke sehr

Anbei noch die Config Datei für die Pinbelegung via SPI.

// COMMON SETTINGS
// ----------------------------------------------------------------------------------------------
// These settings are used in both SW UART, HW UART and SPI mode
// ----------------------------------------------------------------------------------------------
#define BUFSIZE                        128   // Size of the read buffer for incoming data
#define VERBOSE_MODE                   true  // If set to 'true' enables debug output


// SOFTWARE UART SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the pins that will be used for 'SW' serial.
// You should use this option if you are connecting the UART Friend to an UNO
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_SWUART_RXD_PIN       9    // Required for software serial!
#define BLUEFRUIT_SWUART_TXD_PIN       10   // Required for software serial!
#define BLUEFRUIT_UART_CTS_PIN         11   // Required for software serial!
#define BLUEFRUIT_UART_RTS_PIN         -1   // Optional, set to -1 if unused


// HARDWARE UART SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the HW serial port you are using. Uncomment
// this line if you are connecting the BLE to Leonardo/Micro or Flora
// ----------------------------------------------------------------------------------------------
#ifdef Serial1   // this makes it not complain on compilation if there's no Serial1
  #define BLUEFRUIT_HWSERIAL_NAME      Serial
#endif


// SHARED UART SETTINGS
// ----------------------------------------------------------------------------------------------
// The following sets the optional Mode pin, its recommended but not required
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_UART_MODE_PIN        12    // Set to -1 if unused


// SHARED SPI SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the pins to use for HW and SW SPI communication.
// SCK, MISO and MOSI should be connected to the HW SPI pins on the Uno when
// using HW SPI.  This should be used with nRF51822 based Bluefruit LE modules
// that use SPI (Bluefruit LE SPI Friend).
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_SPI_CS               10
#define BLUEFRUIT_SPI_IRQ              8
#define BLUEFRUIT_SPI_RST              -1    // Optional but recommended, set to -1 if unused

// SOFTWARE SPI SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the pins to use for SW SPI communication.
// This should be used with nRF51822 based Bluefruit LE modules that use SPI
// (Bluefruit LE SPI Friend).
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_SPI_SCK              13
#define BLUEFRUIT_SPI_MISO             12
#define BLUEFRUIT_SPI_MOSI             11

sieht für mich so aus, als wenn du Code benutzt für ein Bluefruit LE was seriell angeschlossen ist.
Für das SPI Module musst du:

Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);

benutzen.
Im Setup musst du dann die Verbindung mit SPI starten ( ble.begin(); )

 if ( !ble.begin(VERBOSE_MODE) )
 {
   error(F("Couldn't find Bluefruit, make sure it's in CoMmanD mode & check wiring?"));
 }

schau dir dafür doch einfach die Examples an.

Gruß

Hallo,

ein einfacheres BT Modul hätte es nicht getan?
Bevor ich überhaupt mit Code anfangen würde, würde ich erstmal versuchen ob ich mich mit dem Smartphone überhaupt verbinden kann. Irgendweche Status LEDs wird es dazu auf dem BT Modul sicherlich geben. Vielleicht mußte es auch erst noch konfigurieren. Baudraten o.ä.

Desweiteren muß Pin 10 (53 beim Mega) auf Ausgang definiert sein. Egal ob benutzt oder nicht. Sonst funktioniert SPI nicht.