Hello !
i am working with a project where i send a number “12” to arduino. When i receive the number and print it , it displays garbage characters with itself
Here is the code :
#include <SoftwareSerial.h>
#include <Servo.h>
Servo servo1;
Servo servo2;
int servo1angle=90;
int servo2angle=90;
String str = “”;
int TX = 12;
int RX = 13;
char bufferr[2] ;
int i=0;
SoftwareSerial HC_06(TX, RX); //Bluetooth TX to 10 and Bluetooth RX to 11.
void setup()
{
servo1.attach(7);
servo2.attach(8);
Serial.begin(9600);
HC_06.begin(9600);
}
void loop()
{
while(HC_06.available()> 0 )
{
char bytee = HC_06.read();
if(bytee >=48 && bytee<= 57)
{
bufferr = bytee;
-
i++;*
-
}*
-
if(bytee == ‘:’)*
-
{*
-
//Serial.println(bufferr);*
-
str = bufferr;*
-
Serial.println(str);*
-
str = ‘\0’;*
-
break;*
-
}*
}
}