Hello!
My goal was to send data to an Arduino by a self programmed Android app. To prevent any personal fault, i took firstly a app and the matching Sketch from a Youtube Project. The App/Sketch should turn a LED on and off. Because I tried to connect my Mega 2560 (unsuccesfully) a day before I changed some lines but it was basicly the same code.
Here is now was happend:
- I upload my changed sketch and it worked almost perfect. The readString was depending on the pressed button "on" or "off" and it was printed via the serial monitor.
- I made some minor changes because I added unnecessary lines the day before to troubleshoot my MEGA
- I recogognized after a few tweaks and uploads that I had the "getsync(): not in sync resp=0x30" error all the time. So I didn't upload at all.
- I pull the HC-06 VCC off and upload succesfully the orignial youtube sketch -> up this point i had no more transmission
The current state:
- The Android device and the HC-06 can connect, I just can't receive any data. The TX and RX light's aren't blinking anymore if I press a button on my app.
So my Questions are:
- Have I already broken the module or my UNO r3? And if yes, do got any tips for me to prevent that the next time?
- Is it possible that I deleted something important from the sketch? (Although I tried the fully functional youtube sketch several times after that)
- Do i got an error in my Setup?
Sketch:
int ledPin = 13;
String readString;void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}void loop() {
while (Serial.available()) {
delay(3);
char c = Serial.read();
readString += c;
}
if (readString.length() >0) {
Serial.println(readString);
if (readString == "on")
{
digitalWrite(ledPin, HIGH);
}
if (readString == "off")
{
digitalWrite(ledPin, LOW);
}
readString="";
}
}
Youtube source: https://www.youtube.com/watch?v=6o_QVlltNgM
my Setup: Arduino Sainsmart UNO r3
HC-06
VCC -> 5V
GND -> GND
RXD -> RX
TXD -> TX
thanks in advance