Carlos Russo
Carlos Russo

Reputation: 15

Bluetooth latency from Arduino to Android

I am building a simple piezo drum with arduino and App Inventor. In arduino code, when the piezo threshold is reached, I send an 'a' via bluetooth.

In the other side, there is an App Inventor application running on Android in a Samsung S2 phone. The application simply plays a sound when the 'a' key is received.

The problem i am facing is the latency... Do you know some way to reduce it?, maybe using other library instead SoftwareSerial? I tried with another apps (Bluetooth SPP, etc) with the same results.

The Arduino code is very simple:

#include <SoftwareSerial.h>

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

const int threshold= 30;
int val;

void setup()
{
  bluetooth.begin(115200);
}

void loop()
{
  val = analogRead(sensorPin);

  if (val >= threshold)
  {
    bluetooth.print("a");
  }
} 

Any help would be greatly appreciated...

Upvotes: 1

Views: 1218

Answers (1)

matt
matt

Reputation: 2352

Have you tried the Adafruit library?

It works really well and so fast I don't notice any latency. I'm using the nRF8001 module by the way

#include "Adafruit_BLE_UART.h"

https://github.com/adafruit/Adafruit_Android_BLE_UART

Upvotes: 0

Related Questions