Hi everyone.
Before everything, sorry for my bad english.
Well, i'm building a project using HC05 and HC06 bluetooth modules. I'm trying to communicate between the modules. My project consists in send degrees of inclination from a MPU6050 sensor. The degrees are in decimals and i converted it in characters to send to other bluetooth module, but i lose a lot of precision. About the communication, i can communicate between HC05 and HC06 without troubles, but i'm not able to send a INT or FLOAT number, just characters. I know that modules was programmed to receive and send in ASCII, but can i send characters and at the same time int or float numbers in string form? How can i do it?
if somebody can help me, i'll be a lot of pleased.
Here's a piece of my corrent HC05 code:
void loop() {
[...]
//ypR == float
//eixoX == char
if((ypR > -10) && (ypR < 10)) eixoX = 'P';
if((yPr > -10) && (yPr < 10)) eixoY = 'p';
if(ypR >= 10) eixoX = 'A';
if(ypR >= 20) eixoX = 'B';
if(ypR >= 30) eixoX = 'C';
if(ypR >= 40) eixoX = 'E';
if(ypR >= 60) eixoX = 'F';
if(ypR >= 70) eixoX = 'G';
if(ypR >= 80) eixoX = 'H';
if(ypR >= 90) eixoX = 'I';
if(ypR <= -10) eixoX = 'a';
if(ypR <= -20) eixoX = 'b';
if(ypR <= -30) eixoX = 'c';
if(ypR <= -40) eixoX = 'd';
if(ypR <= -50) eixoX = 'e';
if(ypR <= -60) eixoX = 'f';
if(ypR <= -70) eixoX = 'g';
if(ypR <= -80) eixoX = 'h';
if(ypR <= -90) eixoX = 'i';
//Send the chars to HC06
HC05.print(eixoX);
HC05.print(eixoY);
}
A piece of my HC06 code:
#include <SoftwareSerial.h>
SoftwareSerial HC06(0, 1);
char buf;
void setup() {
Serial.begin(115200);
HC06.begin(38400);
pinMode(11, OUTPUT);
}
void loop() {
while(HC06.available() > 0) {
buf = HC06.read();
analogWrite(11, pitch);
Serial.println(buf);
}
}