Can't see anything obvious but here's my first code for testing Bluetooth.
I used an int and a switch state where you have used a char and an if(state== .....
I can tell you this code works and turns a LED on and off as well as sending a comment back to the android terminal I was using it with. Try it and you will prove your BT connection etc.
#define GREEN 2 // lcd GREEN on pin 2
#include "pins_arduino.h"
int state = 0;
void setup()
{
pinMode(GREEN, OUTPUT);
digitalWrite(GREEN, HIGH);
Serial.begin(9600); // Default connection rate for my BT module
}
void loop() {
//if some data is sent, read it and save it in the state variable
if(Serial.available() > 0)
{
state = Serial.read();
switch (state)
{
case '0':
Serial.println("Jeez, a zero! thanks buddy");
digitalWrite(GREEN, LOW);
break;
case '1':
Serial.println("ah, a 1, as in want 1? well OK then, I'll have a pint of guiness");
digitalWrite(GREEN, HIGH);
break;
}
}
}
Good luck, Steve.