Sending data via bluetooth I am trying to both send and receive data using bluetooth module.

Receiving data works fine with this code:

void setup() { 
    Serial1.begin(9600);
    Serial.begin(9600);
} 

void loop() { 
    if (Serial1.available()) {
        Serial.println(Serial1.read());
    }

    delay(20);                          
}


But I cannot send any data. This is what I am doing:

void loop() { 
    if (Serial1.available()) {
       Serial.println(Serial1.read());
    }

    delay(20);

    if (digitalRead(bluetoothInput) == HIGH) {
        Serial1.write("2");
        // only "send" prints. Nothing in android terminal
        Serial.println("send!");
        delay(1000);
    }

    delay(20);                            
}


What am I doing wrong?

I am using Arduino Leonardo and Bluetooth terminal app on Android device.
I've found the problem

It should be:

Serial1.println("2");


instead of:

Serial1.write("2");