I'm trying to build a pedometer that can detects the acceleration changes from (x,y,z) directions. I can get these values but my main problem is how to send these data via bluetooth? I'm using an app which is ArduDroid from playstore.
When i write a value to Serial and after pressing send button, i can see the value on the app screen. But i can't get the values what i want(accelerometer value like(-1,12)). BT kit is HC-06. Here is the ss:
And here is an example code below:
#include <SoftwareSerial.h>
int bluetoothTx = 1;
int bluetoothRx = 0;
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
void setup()
{
//Setup usb serial connection to computer
Serial.begin(9600);
//Setup Bluetooth serial connection to android
bluetooth.begin(115200);
bluetooth.print("$$");
delay(100);
bluetooth.println("U,9600,N");
bluetooth.begin(9600);
}
void loop()
{
//Read from bluetooth and write to usb serial
if(bluetooth.available())
{
char toSend = (char)bluetooth.read();
toSend='a"
Serial.print(toSend);
}
//Read from usb serial to bluetooth
if(Serial.available())
{
char toSend = (char)Serial.read();
bluetooth.print(toSend);
}
}