Hi,
I'm having trouble setting a new Setpoint in my code using Serial.read.
When I enter 50 via the serial monitor the Setpoint in the code is set to 48. When I enter 52 the Setpoint is 50. So I thought to offset the input of the Setpoint by 2.
When I enter 30 or 90 the Setpoint in the code is 48 also???
For this code to be of any use it is crucial to be able to set the Setpoint, otherwise it will be useless.
Here are the pieces of relevant code (I think). If I need to show the entire code please say so.
int Setpoint = 0;
if (Serial.available() > 0)
{
Setpoint = (Serial.read());
}
I also think the code sometimes stalls after a new Serial read but I'm not sure.
Thanks,
Leo