Go Down

Topic: HELP WITH WEB TEMP CONTROL (Read 988 times) previous topic - next topic

VIKTOR72

I made a simple web  page with temp control and monitor.Sensor is DS18B20.But I don't know how to use a value from textbox and setting the temp. to be controled from the web page.
This is the part from sketch defining the temp. for the heater to turn on:
if (tempC < 26)
  {
    digitalWrite(ledpin,HIGH);
  }
  else if (tempC >=27)
  {
   digitalWrite(ledpin,LOW);
  }

This is the textbox:
"<form><input type=text name=targettemp size=10> <input type=submit value=Ok> </form>"

I know that I should work with defining string and work with there values in buffers but I don't know how.
If someone can help me,and tell me what else should i do to make it work
Thanks

Krodal

#1
Dec 09, 2012, 11:27 am Last Edit: Dec 09, 2012, 11:29 am by Krodal Reason: 1
You can use POST, GET and UDP (and more).
I use a simple GET command.
My textarea is like this:
Code: [Select]

<form name="myform" method="get" action="?">
<textarea name="D" rows="3" cols="45" autofocus=""></textarea><br>
<input value="submit" type="submit">
</form>


If the 'submit' button is clicked, the webpage with the 'D' command sends the contents of the textarea.
If you pass text, it is URL encoded.
I made an URLdecode : http://arduino.cc/forum/index.php/topic,135969.msg1022648.html

So the command would be like this: GET /index.htm?D=47
After the '?' is the command (I use a single character 'D'), and after the '=' is the value.

You don't need the form name "myform", I use it to prefill the textarea with text.
You don't need "autofocus="", I use that to set the cursor in the text field.

VIKTOR72

Thanks,but value from the textbox shuld be stored in EPROM and used as variable for setting the temperautre,because when the power goes off,the temp. setting will lost.This I don't know how to do.

Krodal

If you have a simple webpage, you have to test the URL line with "GET" in it.
You can to a atoi() to make it an integer and store it in EEPROM.
If you need any help, please be more precise.

VIKTOR72

Yes,yes,that is exactly what I need,but I don't know how to do it.
Can you give me an example f,just from defining textbox,defining variables,storing in eprom and using it to set the temperature to be menaged by the heater.From the example before "tempC" is my measured temperature from the sensor.I don't need stuff like defininig and setting sensors and outpit pins.
Thank You for your help.

Go Up