Please need help with my Arduino + Bluetooth --> MIT app inventor

Can anyone help me to check is there any problem with the MIT app inventor blocks. I think there is no problem with the Arduino code as the output is what i wanted when i run it in the serial monitor. Actually I wanted to make an app that connects to Arduino via Bluetooth but I don't know why it doesn't work when I connect the app to the Bluetooth and the app doesn't work the way I wanted to... I can't find out the problem but I think there is no problem with the Arduino bcaus it works well when I run the serial monitor... Can anyone help me to have a look?

  1. Maybe the problem is around if-then

    because I am using the ultrasonic sensor on Arduino to detect the distance of an object and it works well in serial monitor shown. So I am not sure what is the problem with this MIT app inventor blocks

  2. Other users said maybe the problem is with the BytesAvailableToReceive

  • Because it will do nothing when i execute BytesAvailableToReceive>0 .. I'm not sure with it