Controlling a servo motor with HC-06 and Load Cell

Hi all, I'll be short. I'm creating a smart balance. In essence, by using a smartphone connected to the application "BlueSerial", i set the amount of sugar (or another material) that I want to receive. Once setted the quantity in grams, the servomotor opens, dropping the material. Once the weight read by the load cell exceeds the value set by the Bluetooth, the servomotor closes, and the process is terminated.
My problem lies in declaring the amount of sugar via Bluetooth. Once I put it, for example, 500 grams, the servant will always close before (50-60 grams usually). What's wrong? I attach the code to let you have more information.
P.S.: There are no errors at the hardware level, Bluetooth and the load cell circuit are connected perfectly, as well as the servomotor.

smart_balance_v2.ino (1.19 KB)

You know that Serial.read() returns only one byte? You should not read from the serial port until there is some data available. The serial input basics thread will show how to receive multiple bytes and parse the data.

Please read the "how to use the forum" stickies to see how to format and post code. Many people will not download code.

the servant will always close before (50-60 grams usually)

I'm going to guess that it is actually 49 to 58 grams. Look at those numbers in an ASCII table for a clue.