Have made my first app and connected to the HC-06 (tagged the HC-05 as it is only one available) all successful except some cases.
Background is I'm using the BT app to allow a User to choose from a list of patterns what colour a strip of LEDs lights to. The code to change the LED patterns are on the Arduino and i used a if, If else ladder to swap between which pattern is running. The app sends the first three letters of the pattern chosen from the Pick List selection to the arduino.
To try and fix the issues I have joined a messageStart and messageEnd character to each message sent. when Serial. available is true it peeks and looks for the messageStart character if it is not the right char then it reads the char from the buffer in-order to clear it. If the peeked char is the messageStart char then it reads the data (as a string) untill the messageEnd char is found this didn't help much... My next thoughts are to scope the RX signal to see if it is still a square. Since I am using Serial.Print() to print the received text could this slow the received messages?
BT_App_2.ino (11.0 KB)
*When I choose red, white or blue from the pick list the data does not send reliably and the button needs tapped a few times caused by below
*after a few taps the data received is not "Red" "Whi" or "Blu" and sometimes comes up as "))?" and other garbled charicters
*The when the any colour message is tapped a few times it stalls changing the colour, when you pick another pattern to get out of the stall it runs the any colour pattern.
*I feel like this is mainly a Arduino code issue as the MIT app has worked pretty much flawlessly
if you need the full app let me know how to link it or I can screenShot it