I'm using an Arduino Uno with an Adafruit Dotstar LED strip (144 LEDs) and HC-05 to make the LEDs changeable through my phone. Almost everything works, except I can't get the app to correctly send data to my HC-05 device, which I can see through the Serial monitor. In the app (using MIT App Inventor BluetoothClient), I've put spaces in between every character I want to send, which works to an extent. However, when trying to send larger amounts of data, such as 3 different RGB colors (about 75 characters), or trying to send different commands to the Arduino, some of the data is just left out, as though it's not even sent. I still don't understand why it picks up exactly every other character either. I sway against it being a problem with my Arduino code, but rather a misunderstanding of the hardware I'm using to do this. I'm a beginner and can find nothing on the web about why this is happening. Thank you.
#include <Adafruit_DotStar.h>
#include <SPI.h> // COMMENT OUT THIS LINE FOR GEMMA OR TRINKET
#include <SoftwareSerial.h>;
SoftwareSerial BT(10, 11); //TX , RX
#define NUMPIXELS 144 // Number of LEDs in strip
#define DATAPIN 4
#define CLOCKPIN 5
Adafruit_DotStar strip = Adafruit_DotStar(
NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTAR_BGR);
void setup() {
Serial.begin(9600);
BT.begin(9600);
Serial.println("We are gucci");
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000L)
clock_prescale_set(clock_div_1); // Enable 16 MHz on Trinket
#endif
strip.begin(); // Initialize pins for output
strip.show(); // Turn all LEDs off ASAP
}
void stringTakeDo()
{
if((!Serial.available()) && (!Serial.read() != -1))
{
while(BT.available() && BT.read() != 0 && Serial.read() == -1)
{
delay(10);
char incomingChar = BT.read();
str += incomingChar;
}
}
else if(Serial.available() && Serial.read() > -1)
{
str = Serial.readString();
}
}