Hello, I'm using the Serial Monitor to test my code, but it seems to be freezing for some reason. I'm using App Inventor 2 to send Bluetooth data to the Arduino with a HC-05 BT module. When sending from a button press, it works fine. I setup a Clock on the app to send data and a given speed. I went from 1 full second to 1 millisecond and received the data just fine. It's when I use a slider on the app, the arduino seems to freeze. I don't know if it's being overwhelmed with data or it's something else. I'm running 115200 baud. Here's my code:
#include<SoftwareSerial.h>
int bluetoothTX = 12;
int bluetoothRX = 13;
SoftwareSerial bluetooth(bluetoothTX, bluetoothRX);
char textA;
char textB;
int delimiter1 = '#';
int delimiter2;
int delimiter3;
int R;
int G;
int B;
int A;
int Rvalue;
int Gvalue;
int Bvalue;
int Avalue;
void setup() {
Serial.begin(115200);
bluetooth.begin(115200);
bluetooth.println("BT Online!");
Serial.println("Let's Go!");
}
void loop()
{
if (bluetooth.available() == 10)
{
if (bluetooth.peek() == 35)
{
int delimiter1 = bluetooth.read();
int R = bluetooth.read();
int Rvalue = bluetooth.read();
int G = bluetooth.read();
int Gvalue = bluetooth.read();
int B = bluetooth.read();
int Bvalue = bluetooth.read();
int A = bluetooth.read();
int Avalue = bluetooth.read();
int delimiter2 = bluetooth.read();
if ((delimiter1 = 35) && (delimiter2 = 35))
{
Serial.print("R : ");
Serial.print(Rvalue);
Serial.print(" G : ");
Serial.print(Gvalue);
Serial.print(" B : ");
Serial.print(Bvalue);
Serial.print(" A : ");
Serial.println(Avalue);
}
}
}
}