user_v22giz32y
user_v22giz32y

Reputation: 125

Bluetooth serial communication issue between Arduino and Android

I have written an application for Android in Java using Eclipse to send data to an Arduino via Bluetooth.

The devices seem to be connected okay, but when I send data from the Android to the Arduino the receive (RX) light on the Arduino board doesn't light up.

Can someone help?

#define arduinoRx 2
#define arduinoTx 3 
int gelen_veri;
int LedCikis = 8;

SoftwareSerial bluetooth(arduinoRx, arduinoTx);    

void setup() {
    bluetooth.begin(9600);
}

void loop() {
    if (bluetooth.available() > 0) {

        gelen_veri=bluetooth.read();    

        switch (gelen_veri) {

            case 'A' :
                digitalWrite(LedCikis, HIGH);
            break;

            case 'K' :
                digitalWrite(LedCikis, LOW);
            break;

            default:
            break;
        }
    }
}

Upvotes: 2

Views: 1055

Answers (1)

Theoneil Steenkamp
Theoneil Steenkamp

Reputation: 21

Use the serial rx/tx pins instead of SoftwareSerial. I've had problems with SoftwareSerial in the past and my HC-05 bluetooth module.

Upvotes: 1

Related Questions