Problem receiving data from android smartphone to HC-05 bluetooth module.

Hello,

I have a problem receiving data which are sent via an app called BlueTerm2 from my android smartphone to my HC-05 bluetooth module. The strange thing is that the connection works really well. I can receive data on my smartphone sent from the module but I can't send any.

I know that there are multiple threads regarding this issue but so far I haven't found a solution that works.

My setup is as following:

1x Arduino Mega 2560 1x HC-05 Bluetooth Module 3x LEDs (red, yellow, green)

The RX0 pin from Mega 2560 is connected to TXD on the bluetooth module and the TX0 is connected to RXD. Grounds are also connected. My code is based on http://www.instructables.com/id/Arduino-Control-DC-Motor-via-Bluetooth/?ALLSTEPS and even if I copy the given code 1:1 I still have the problem that I don't receive data from the smartphone app.

My code:

const int ledPin1 =  2; //green led
const int ledPin2 =  3; //yellow led
const int ledPin3 =  4; //red led

char state;

void setup()
{
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  if(Serial.available())
  {
    state = Serial.read();
    Serial.println(state);
    digitalWrite(ledPin3, HIGH);
    if(state == '0')
    {
      digitalWrite(ledPin2, HIGH);
    }
    else if(state > 0)
    {
      digitalWrite(ledPin2, LOW);
      digitalWrite(ledPin1, HIGH);
    }
    else
    {
      digitalWrite(ledPin1, LOW);
      digitalWrite(ledPin2, LOW);
      digitalWrite(ledPin3, LOW);
    }
  }
}

It is actually a pretty simple code but I just can't get it to work properly. Although I think that it is not a problem with the code itself. I also read in that article that it works by using SoftwareSerial. The answers were that there is no need to use SoftwareSerial but no solutions for the problem. I am pretty new to arduino and I hope that you guys can help me with my problem. Thanks, Minato