Pages: [1]   Go Down
Author Topic: HELP WITH WEB TEMP CONTROL  (Read 778 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1010
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can use POST, GET and UDP (and more).
I use a simple GET command.
My textarea is like this:
Code:
<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.
« Last Edit: December 09, 2012, 05:29:57 am by Krodal » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1010
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1010
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm sorry, but I can't write the sketch for you.
You have to find examples for the webserver that accepts data.
If you print (to the serial port) the data from to browser, you can see the line with 'GET' in it.
You also have to find examples how to use the EEPROM.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok,thanks for your help.I already tried to search exapmles,I found some examples,but not for my needs and I couldn't figure it out.Thats why I wanted some help.I can see here from other posts people are giving examples and I figured out many things by those examples.But never mind maybe someone else could give me an example ,or maybe I better post this thread to  programing forum.
Logged

Offline Offline
Edison Member
*
Karma: 9
Posts: 1010
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think these are a good start:
http://playground.arduino.cc/Code/WebServer
http://arduino.cc/en/Reference/EEPROMWrite
Logged

Pages: [1]   Go Up
Jump to: