Hello, I'm trying to make a circuit that involves a bluetooth module and connecting a servo so I can control a servo from my phone with an app I created. everything works fine except for 1 thing. my app sends numbers over bluetooth to the arduino but the way it does it is by sending 1 character at a time for example if it needs to send 152 it will send 1 then 5 then 2 instead of 152. since im using degrees that goes from 0 all the way to 170, it can be single, double or tripple digit, so I cant just combine it three times because if its a single digit it will try waiting for 2 more digits. any ideas on how to fix this?
Does the sketch you posted work at all? It looks like you are reacting to every single character, and that character's ASCII code is being put in the servo.
You may want to look at Serial.parseInt, it will wait and gather characters and return you a number which may be just right for this circumstance.
to fix my issues all I did was add 1 line of code :
Serial.setTimeout(25);
for anyone else that has the issue you might need to fidle around with the timing of the timeout so you would need to change 25 to a number that supports you