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...