6v6gt:
What arduino are you using ? clearly it has hardware Serial1.I recommend you put in some debug statements so you can see on the serial console (Serial that is, not Serial1) what you get from the bluetooth device and follow the progress of the sketch. Then it will be clearer to you where your logic is failing.
Arduino Leonardo