[URGENT] Send Serial from Arduino to Android via Bluetooth

Hi there,

I'm developing a padlock which controlled from Android app with history feature, so every time the padlock is unlocked or locked that will be recorded.

I'm using Servo and HM-06 Bluetooth module and switch button for locking the padlock and for the Android app, I use MIT App Inventor 2.

There's no problem when I unlock the padlock from the Android app. But the problem is when I push switch button from the Arduino, the Android app won't read it automatically.

Here's my code :

 int buttonState = digitalRead(buttonLock);
    
     if (buttonState == LOW && pos == 60) // button pushed
       {
        slock.write(90); // lock the servo
        pos = 90;
        buttonState = HIGH; // button not pushed
        Serial.print(90); // print the value
        Serial.print('\n'); // return
       }
       
       delay(15);

Any ideas how to fix it so the Android app can read automatically what the Bluetooth is sending? Thank you!

Any ideas how to fix it so the Android app can read automatically what the Bluetooth is sending?

You want some ideas on how to fix code you didn't post?