Hello,
I try to fix a project. This project consist to send the accelerometer values to the Arduino Uno R3 and this via bluetooth. I have converted it into a char type and print it to the serial monitor. This was quite easy. Now I'm trying to convert it into a float type but i don't know how to do that. I have already tried different things but nothing happens like i want.
Here is the original code i used to convert it into a char type. I tried it with parseFloat or put the bytes into an array.
Please can someone help me to fix the project. I have already try it for more than two weeks and it is really desperated.
#include <SoftwareSerial.h>
#define RxD 6
#define TxD 7
SoftwareSerial blueToothSerial(RxD,TxD);
void setup() {
Serial.begin(9600);
pinMode(RxD, INPUT);
pinMode(TxD, OUTPUT);
pinMode(Led,OUTPUT);
setupBlueToothConnection();
}
void loop() {
char recvChar;
while(1){
if(blueToothSerial.available()){
recvChar=blueToothSerial.read();
Serial.print(recvChar);
}
}
}
void setupBlueToothConnection()
{
blueToothSerial.begin(38400); //BaudRate auf 38400 setzen
blueToothSerial.print("\r\n+STWMOD=0\r\n"); //BluetoothShield arbeitet als Slave
blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n"); //BluetoothName für das Pairing "SeeedBTSlave"
blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Erlaub einem anderen Masterdevice zum Verbinden mit dem BluetoothShield
blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Automatischeverbindung darf nicht geschehen
delay(2000); // Pause muss dazwischen sein
blueToothSerial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable
Serial.println(""); //Text zum Serial Monitor schicken
delay(2000); // Pause muss nach der Erzeugung drinen sein ansonsten bleibt dies in einer Schleife hängen
blueToothSerial.flush(); //Bluetoothpulse werden gestartet
}