Author Topic: Sending data from Android to Simblee BLE not returning anything  (Read 99 times)

danyyacoub

  • RFduino Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Sending data from Android to Simblee BLE not returning anything
« on: November 25, 2017, 09:15:06 AM »
Below is the sketch of my Simblee :

Code: [Select]
#include <SimbleeBLE.h>

void setup() {
  Serial.begin(9600);
  Serial.println("Waiting for connection...");
  SimbleeBLE.deviceName = "Simblee";
  SimbleeBLE.advertisementData = "data";
//  SimbleeBLE.customUUID = "2220";
  SimbleeBLE.advertisementInterval = MILLISECONDS(300);
  SimbleeBLE.txPowerLevel = -20;  // (-20dbM to +4 dBm)
  SimbleeBLE.begin();
}

void loop() {

}

void SimbleeBLE_onConnect()
{
  Serial.println("Simblee Connected");
}

void SimbleeBLE_onDisconnect()
{
  Serial.println("Simblee Disconnected");
}

void SimbleeBLE_onReceive(byte *data, int len)
{
  Serial.println("Data received");
  SimbleeBLE.send(1);
  printf("%s\n", data);
}

void serialEvent()
{
   Serial.println("Serial event");
}

I can easily connect and read data from it, bit writing to it doesn't work from my app. SimbleeBLE_onReceive is never being called.

It actually never is called even when using third party BLE apps like nRF Connect and BLE Terminal.

So I'm suspecting that the issue is with my arduino Sketch and not related to the android code.

The android code is returning GATT_ERROR 133 when trying to write.

Is anything missing from this code ? Strangely I can't find any example online where we're simply sending data to Simblee (without using SimlbeeMobile)

Thanks,

tolson

  • Global Moderator
  • *****
  • Posts: 870
  • Karma: +20/-0
    • View Profile
    • Thomas Olson Consulting
Re: Sending data from Android to Simblee BLE not returning anything
« Reply #1 on: November 26, 2017, 07:49:46 PM »
ONE mistake.

void SimbleeBLE_onReceive(byte *data, int len)

should be...

void SimbleeBLE_onReceive(char *data, int len)

danyyacoub

  • RFduino Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Sending data from Android to Simblee BLE not returning anything
« Reply #2 on: November 28, 2017, 08:22:58 AM »
Thank you, that was it!!

 

anything