The code is to large to post in text so I have attached the sketch instead.
You can see the thermostat @ http://192.40.125.129:801/ Feel free to play with it. I have put some debugging on the displayed website as well.
That I know of, these are my issues...
When I press the web button for "heating mode", or "cooling mode" the sketch goes through both heating and cooling mode loops for just a brief second and then exits. However, when I press the web button for "recirculation mode" it stays in the recirc loop.
I have a text form for submitting a new temperature that I want the thermostat set to. When I put in a value and click the submit button the only thing that happens is the address bar gets an updated address... (http://172.16.32.178:801/?S=75)
I am trying to receive my new set temp through client.parseint and save it to a variable (setTemp) ... setTemp = client.parseInt();
Instead I am always receiving 172 on client.parseint.
Any help would be really great! I have been struggling with this.
The first one is likely that you have no tolerance for heating or cooling. That is, the temperature range for heating overlaps that for cooling, at at least one point.
The second is probably that you don't have any code that cares what the client requests. The code you didn't actually share simply returns the same response for every request.
I mean, I hardware select from four possible states, COOL, HEAT, FAN or OFF. the thermostat then behaves differently depending on that setting, even though I am using the same buttons to control it (set point).
I thought thats what I did?
Actually, you have one state that is calling some functions.
I don't really get what I'm looking at here...
you can experiment with his example to see what's happening.
The link you provided was for something other that the state machine example. I found it and have been working with it. I tried an implementation of it in my thermostat but it doesn't seem to do anything. my thermstate (the state that should be stored) always comes back as the number 1.
I uploaded the new code to this post.... really, I did.. LOL
client.println(thermstate);
client.println("
");
client.println("<p>Base Code by Rui Santos at http://randomnerdtutorials.com. Modified by Gary Boyce http://www.modsbyus.com </p>");
client.println("
");
client.println("</BODY>");
client.println("</HTML>");
Can you give me some insight as to why I am receiving a 1 for my thermstate instead of the actual thermstate? That would be very helpful in dubugging if I could fix that.
if (readString.indexOf("?button1on") > 0) {
switch (thermstate) {
thermstate = coolON;
case coolON:
cool();
break;
}
Using a switch statement generates more code than an if statement, when there are less than three cases. Assigning a value to themrmstate in a switch statement, outside of a case statement is wrong. Nothing should happen in a switch statement that is not part of a case statement.
switch (thermstate) {
thermstate = coolON;
case coolON:
cool();
break;
}
Using a switch statement generates more code than an if statement, when there are less than three cases. Assigning a value to themrmstate in a switch statement, outside of a case statement is wrong. Nothing should happen in a switch statement that is not part of a case statement.
So...
Like this.
if (readString.indexOf("?coolon") > 0) {
switch (thermstate) {
case coolON:
thermstate = coolON;
cool();
break;
}
Can anyone help me understand what I have done wrong here? I have followed http://www.gammon.com.au/forum/bbshowpost.php?id=12316 to the best of my ability and instead of thermstate being updated with one of these (coolON, thermOFF, heatON, recircON) it just always gets a number 1 . I'm open to just getting a really good resource that explains what to do and not to do. From what I have read enum isn't really any different than int in that it is for storing an integer. I'm not sure how any of this is to work if I'm trying to store a word!
I also have found that none of my if statements that are dependent on the readString will run because I keep receiving
readString: GET /?coolon HTTP/1.1
thermstate: 0
73
readString: GET /favicon.ico HTTP/1.1
thermstate: 0
73
My if staements are looking for the button press "readString: GET /?coolon HTTP/1.1" but after that comes through I also get "readString: GET /favicon.ico HTTP/1.1". I don't know where this favicon.ico is coming from. Its not in my code anywhere that I can find. I'll be doing some research in the mean time but I thought it would be good to have here for anyone else with the same problem.