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)