1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
if( x == 0 )
{
???
SETTEMP = Serial.parseInt();
Serial.print("What is the Temperature Setpoint? ");
while ( Serial.available() == 0 )
{
???
}
Serial.println(SETTEMP);
SETDIF=Serial.parseInt();
Serial.println("What is the Differential Setpoint? ");
while ( Serial.available() == 0 )
{
???
}
SETHUM=Serial.parseInt();
Serial.println("What is the Humidity Setpoint? ");
while ( Serial.available() == 0 )
{
???
}
}
}
|
@Wally2u
I decided to have a look at your code and a couple of points arise:
1. You code compiles without error using the standard Arduino IDE. This obviously is a plus and combined with my comments on your numerous while loops my guess is it's program logic and/or lack of a device communication that's the problem.
2. The problems you are having are not clear. It is good practice to state clearly what you are attempting to do, what the inputs are, what the expected outputs are, and what actually happened including full details of any error messages.
3. As a suggestion, and of course it's your choice, you might consider a clearer layout of your code by using whitespace and adding comments, pre/post condition statement even.
4. The code snippet I have attached is a direct copy of your code but clearly shows that there are possibly a number of infinite loops, who knows. Good and simple debugging practice, especially because of how Arduino's work is to include a dummy message inside the loop for display to the console. I've indicated with a ??? where I would have put them. ( Turning an LED on is another exotic option. )
5. Needless to say I have no idea about the development cycle you went through to end up with your 123 lines of program. Aside from having an overall plan of some sort, good practice dictates testing as you go. I assume you reached a point where the program crashed or stopped doing what you wanted (went silent due to an infinite loop) before 123 lines were written.