Show Posts
Pages: [1] 2 3
1  Using Arduino / General Electronics / Termistor on: November 07, 2011, 05:38:58 pm
Hi
I have achieved a Produal Teat ntc 20 that is a termistor that is 20k when its 25 degree celcius, by putting a 20k resistor on the other side of a voltage divider, i can get a reading of about 10-40 degrees (according to data sheet). but is it possible to expand the measuring area somehow? aka use other resisistors to increase the voltage divider?

may be a simple soulution, but i'm tired, and my head is not working optimal =P
2  Using Arduino / Programming Questions / Re: if/else question on: November 05, 2011, 08:37:22 pm
aha... i did put in the error part to see if the input was floating... because i was experimenting with inputs...

thanks for the help  smiley-cool
3  Using Arduino / Programming Questions / if/else question on: November 05, 2011, 02:13:28 pm
Hi
i have a web server on my arduino duemilanove, and with this code, i get printed both "feedback high" and "feedback error"
Code:
 
  feedbackin = digitalRead(feedback);
 
  if (feedbackin == HIGH){
    client.println ("<font color='green' size='5'>Feedback high</font>");
  }
 
  if (feedbackin == LOW) {
    client.println ("<font color='grey' size='5'>Feedback low</font>");
  }
 
  else {client.println ("<font color='red' size='5'>Feedback ERROR</font>");
  Serial.println ("FEEDBACK ERROR");
  Serial.println (feedbackin);
  Serial.println ("");
  }
gives output
"Feedback high Feedback ERROR"

anyone that have a clue on why this happen?
4  Using Arduino / Project Guidance / Re: DSI (Digital Signal Interface) communication with Arduino on: November 02, 2011, 12:31:35 pm
Hi
I'm working on the same thing, but after my little reasearch i could not find much information... it looks like you have to hardcode the encoding and things like that... same thing on DALI (digital addressable light interface)

but it could be nice if somebody had some information or a lib...
5  Topics / Home Automation and Networked Objects / Re: Internet Control of Arduino on: March 25, 2011, 03:06:41 am
I have a code that work in the version 22 of the IDE
this code will display a site with options to turn on/off outputs, and show values of analog sernsors =)

Code:
//*******************************

#include <SPI.h>
#include <Ethernet.h>

/*
Simple Ethernet Test
Arduino server outputs simple text to browser
and controlling LED with simple checkbox

The circuit:
* Arduino Duemilanove
* Arduino Ethernet shield
* LED connected to GND and digital pin 4 via resistor
By Minde
http://www.sciencprog.com/

**************************************************************
*  Edited by Haavard GJ to work in version 0021              *
*  Thanks to PaulS for the big help on getting this to work  *
**************************************************************
*/


 byte    mac[] =     { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };   //physical mac address
 byte    ip[] =      { 192, 168, 2, 110 };                     // ip in lan
 byte    gateway[] = { 192, 168, 2, 1 };                       // the IP of the router or acsesspoint
 byte    subnet[] =  { 255, 255, 255, 0 };                     //subnet mask (i dont think this is neccesary
 Server  server(80);                // server port (change this if you are having a local webserver else than the arduino)
 int     ledPin = 4;                // LED pin
 int     heatpin = 5;               // Heating *relay* (change this if you want)
 int     lightpin = 6;              // lights
 int     sensorPin = A0;            // analog in 0 for testing
 int     sensorValue = 0;           // integer for the analog sensor
 String  readString = String(30);   // string for fetching data from address
 boolean LEDON = false;             // LED status flag
 boolean HEATON = false;            // Heat status flag  (add more status flags if you need more outputs)
 boolean LIGHTON = false;           // lights *test*

void setup()
{   
  Serial.begin(57600); //enable serial datada print
  Ethernet.begin(mac, ip, gateway, subnet); //start Ethernet
 
  pinMode(ledPin, OUTPUT); //Set pin 4 to output
  pinMode(heatpin, OUTPUT);
  Serial.print("Starting server"); //for debugging
 
  sensorValue = analogRead(sensorPin);
}

void loop(){

  Client client = server.available();  // Create a client connection
    if (client) {
      while (client.connected()) {
        if (client.available()) {

          char c = client.read();

        if (readString.length() < 30) { //read char by char HTTP request
          readString.concat(c); } //store characters to string
         
        Serial.print(c); //output chars to serial port for debugging
       



        if (c == '\n') { //if HTTP request has ended
       
          Serial.println("");
          Serial.println(readString); // print for debugging
          Serial.println("");
          int Le = readString.indexOf("L="); // led         here is a key component of where
          int He = readString.indexOf("H="); // heat        the status is being read by the arduino
          int V = readString.indexOf("V"); // light
          Serial.print("L= position: ");
          Serial.println(Le);
          Serial.print("H= position: ");
          Serial.println(He);
          Serial.print("V= position: ");
          Serial.print(V);
         
         
         
         
         
         
          //lets check if LED should be lighted
          if (Le > 1){
         
          if (readString.substring(Le,(Le+3)) == "L=1") { //led has to be turned ON
              digitalWrite(ledPin, HIGH); // set the LED on
              Serial.println("ledpin paa"); // debugging
              LEDON = true;
          }

          if (readString.substring(Le,(Le+3))== "L=0") {
            //led has to be turned OFF
            digitalWrite(ledPin, LOW); // set the LED OFF
            Serial.println("ledpin av"); //debugging
            LEDON = false;
           }}
           
           if (He > 1){
             
          if (readString.substring(He,(He+3)) == "H=1") { //heat has to be turned ON
              digitalWrite(heatpin, HIGH); // set the heat on
              Serial.println("heatpin paa");//debug
              HEATON = true;
          }

          if (readString.substring(He,(He+3)) == "H=0") {
            //heat has to be turned OFF
            digitalWrite(heatpin, LOW); // set the heat OFF
            Serial.println("heatpin av"); //debug
            HEATON = false;
           }}
           
            if (V > 1){
             
          if (readString.substring(V,(V+3)) == "V=1") { //light has to be turned ON
              digitalWrite(lightpin, HIGH); // set the heat on
              Serial.println("lys paa pin 6");//debug
              LIGHTON = true;
          }

          if (readString.substring(V,(V+3)) == "V=0") {
            //light has to be turned OFF
            digitalWrite(lightpin, LOW); // set the heat OFF
            Serial.println("lys av"); //debug
            LIGHTON = false;
          }}
           


  client.println("HTTP/1.1 200 OK"); //output HTML data starting with standart header
  client.println("Content-Type: text/html");
  client.println();
  client.print  ("<body style=background-color:white>"); //set background to white

  // HTML Code

  client.println("<font color=’red’><h1>Arduino Remote control</font></h1>");//send first heading

  client.println("<font color=’blue’ size=’5′>Analog input 0: "); //print analog in to the browser
 
 
  sensorValue = analogRead(sensorPin);


  client.print(sensorValue);//Analog input.
  Serial.print(sensorValue);

  client.println("<br />");//some space between lines

  //controlling led via checkbox
  client.println("<h1>LED control</h1>");

  // address will look like http://192.168.1.110/?L=1 when submited
  // this line will give the radiobuttons that give the input
  client.println("<form method=get name=LED> <input type='checkbox' name='L' value='1'>LED<br><br><input type='checkbox' name='H' value='1'>HEAT<br><br><input type='checkbox' name='V' value='1'>Light <br><input type=submit value=submit></form>");
  client.println("<br />");
 
  //printing LED status
  client.print("<font size=’4′>LED status: ");
  if (LEDON == true) {
     client.println("<font color='green' size='4'>ON</font>");
     Serial.print("led on pin 4");
   }
   else {
    client.println("<font color='red' size='4'>OFF</font>");
    Serial.println("Led off pin 4");
   }

  client.print("<br />");

 //printing LED status
  client.print("<font size=’4′>Heatpin status: ");
  if (HEATON == true) {
     client.println("<font color='green' size='4'>ON</font>");
     Serial.print("Heat on pin 5");
   }
   else {
    client.println("<font color='red' size='4'>OFF</font>");
    Serial.println("Heat off pin 5");
   }
   client.print("<br />");
   
     client.print("<font size=’4′>Light status: ");
  if (LIGHTON == true) {
     client.println("<font color='green' size='4'>ON</font>");
     Serial.print("light on pin 6");
   }
   else {
    client.println("<font color='red' size='4'>OFF</font>");
    Serial.println("light off pin 6");
   }



  client.println("</body></html>");


readString=""; //clearing string for next read

client.stop(); //stopping client

Serial.println("stopped client"); // for debugging

}}}}}
6  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: String(?) error on: December 21, 2010, 03:00:09 am
i'll see on it when i get home from work,

but i'm so glad i finaly get it to work... i think i have used almost 3 weeks just trying to find some code to use, and then it was so damn frustrating when it didn't work  :-?


anyway, thanks again for your help  smiley-grin smiley-wink
7  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: String(?) error on: December 20, 2010, 05:58:00 pm
Horayyy... now i got it to work as intended   8-) smiley-grin

Code:

//*******************************

#include <SPI.h>
#include <Ethernet.h>

/*
Simple Ethernet Test
Arduino server outputs simple text to browser
and controlling LED with simple checkbox
The circuit:
* Arduino Duemilanove
* Arduino Ethernet shield
* Basic FTDI breakout 5V  
* LED connected to GND and digital pin 4 via resistor
By Minde
http://www.sciencprog.com/
*/

 byte    mac[] =     { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };   //physical mac address
 byte    ip[] =      { 192, 168, 2, 110 };                     // ip in lan
 byte    gateway[] = { 192, 168, 2, 1 };                       // internet access via router
 byte    subnet[] =  { 255, 255, 255, 0 };                     //subnet mask
 Server  server(80);                // server port
 int     ledPin = 4;                // LED pin
 int     heatpin = 5;               // Heating *relay*
 int     sensorPin = A0; // analog in 1 for testing
 int     sensorValue = 0;
 char    link[]= "";                // link data
 String  readString = String(30);   // string for fetching data from address
 boolean LEDON = false;             // LED status flag
 boolean HEATON = false;             // Heat status flag
 

void setup()
{    
  Serial.begin(57600); //enable serial datada print
  Ethernet.begin(mac, ip, gateway, subnet); //start Ethernet
  
  pinMode(ledPin, OUTPUT); //Set pin 4 to output
  pinMode(heatpin, OUTPUT);
  Serial.print("Starter server");
  
  sensorValue = analogRead(sensorPin);
  Serial.println("");
  Serial.println("");
  Serial.println (sensorValue);
  Serial.println("");
  Serial.println("");

}

void loop(){

  Client client = server.available();  // Create a client connection
    if (client) {
      while (client.connected()) {
        if (client.available()) {

          char c = client.read();

        if (readString.length() < 30) { //read char by char HTTP request
          readString.concat(c); } //store characters to string
          
        Serial.print(c); //output chars to serial port for debugging
        

//indexOf("L=")

        if (c == '\n') { //if HTTP request has ended
        
          Serial.println("");
          Serial.println(readString); // print for debugging
          Serial.println("");
          int Le = readString.indexOf("L=");
          int He = readString.indexOf("H=");
          Serial.print("L= position: ");
          Serial.println(Le);
          Serial.print("H= position: ");
          Serial.println(He);
          
          
          
          
          
          //lets check if LED should be lighted
          if (readString.substring(Le,(Le+3)) == "L=1") { //led has to be turned ON
              digitalWrite(ledPin, HIGH); // set the LED on
              Serial.println("ledpin paa");
              LEDON = true;
          }

          if (readString.substring(Le,(Le+3))== "L=0") {
            //led has to be turned OFF
            digitalWrite(ledPin, LOW); // set the LED OFF
            Serial.println("ledpin av");
            LEDON = false;
           }
          
          
          if (readString.substring(He,(He+3) == "H=1") { //heat has to be turned ON
              digitalWrite(heatpin, HIGH); // set the heat on
              Serial.println("heatpin paa");
              HEATON = true;
          }

          if (readString.substring(He,(He+3) == "H=0") {
            //heat has to be turned OFF
            digitalWrite(heatpin, LOW); // set the heat OFF
            Serial.println("heatpin av");
            HEATON = false;
           }
          
          
          
          


client.println("HTTP/1.1 200 OK"); // now output HTML data starting with standart header
client.println("Content-Type: text/html");
client.println();
client.print  ("<body style=background-color:white>"); //set background to white

// HTML Code

client.println("<font color='red'><h1>Arduino fjernstyringsside</font></h1>");//send first heading
client.println("<hr />");
client.println("<font color='blue' size='5[ch8242]>Analog input: "); //output some sample data to browser
  sensorValue = analogRead(sensorPin);


client.print(sensorValue);//lets output some data
Serial.print(sensorValue);

client.println("<br />");//some space between lines
client.println("<hr />");
client.println("<font color='green'>Simple table: "); //drawing simple table
client.println("<br />");
client.println("<table border=1><tr><td>row 1, cell 1</td><td>row 1, cell 2</td></tr>");
client.println("<tr><td>row 2, cell 1</td><td>row 2, cell 2</td></tr></table>");

client.println("<br />");
client.println("<hr />");


//controlling led via checkbox
client.println("<h1>LED control</h1>");

//address will look like http://192.168.1.110/?L=1 when submited
client.println("<form method=get name=LED> <input type='radio' name='L' value='1'>LED ON<br><input type='radio' name='L' value='0'>LED OFF<br><input type='radio' name='H' value='1'>HEAT ON<br><input type='radio' name='H' value='0'>HEAT OFF<br><input type=submit value=submit></form>");

client.println("<br />");
//printing LED status
client.print("<font size='5[ch8242]>LED status: ");
  if (LEDON == true) {
     client.println("<font color='green' size='5[ch8242]>ON");
     Serial.print("led på");
 }
  else {
    client.println("<font color='grey' size='5[ch8242]>OFF");
   }

client.println("<hr />");
client.println("<hr />");
client.println("</body></html>");
//clearing string for next read
readString="";

//stopping client

client.stop();

Serial.println("Stopper klient");

}}}}}

now as it works, i'm going to modify the code to get more in/outputs

here is what got out of the serial monitor:

Code:
Starter server




GET /?L=1 HTTP/1.1

30GET /?L=1 HTTP/1.1


L= position: 8
H= position: -1
Stopper klient


GET /?L=1 HTTP/1.1


L= position: 6
H= position: -1
ledpin på
led påStopper klient
GET /?L=0 HTTP/1.1

GET /?L=0 HTTP/1.1


L= position: 6
H= position: -1
ledpin av
Stopper klient

just to have said it, i tested several times, and it did work all the time after i had put in the "Le" and "He"

Thanks for your help  8-)

8  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: String(?) error on: December 20, 2010, 10:39:29 am
after putting in serial.print(readstring) i have got theese results on the serial monitor
the highlighted lines are from the readstring
Code:
Starter server

499 (analog input)


G
[glow]30G[/glow]

E[glow]
30GE[/glow]

T
[glow]30GET[/glow]

 
[glow]30GET [/glow]

/
[glow]30GET /[/glow]

?
[glow]30GET /?[/glow]

L
[glow]30GET /?L[/glow]

=
[glow]30GET /?L=[/glow]

1
[glow]30GET /?L=1[/glow]

 
[glow]30GET /?L=1 [/glow]

H
[glow]30GET /?L=1 H
[/glow]
T
[glow]30GET /?L=1 HT[/glow]

T
[glow]30GET /?L=1 HTT[/glow]

P
[glow]30GET /?L=1 HTTP
[/glow]
/
[glow]30GET /?L=1 HTTP/[/glow]

1
[glow]30GET /?L=1 HTTP/1[/glow]

.
[glow]30GET /?L=1 HTTP/1.[/glow]

1
[glow]30GET /?L=1 HTTP/1.1

[/glow]

[glow]30GET /?L=1 HTTP/1.1[/glow]



[glow]
30GET /?L=1 HTTP/1.1
[/glow]

Stopper klient (stopping client)

and here is the code for the printing:
Code:
 Client client = server.available();  // Create a client connection
    if (client) {
      while (client.connected()) {
        if (client.available()) {

          char c = client.read();

        if (readString.length() < 30) { //read char by char HTTP request
          readString.concat(c); } //store characters to string
          
        Serial.print(c); //output chars to serial port for debugging
        Serial.println("");
       [glow] Serial.println(readString); // print for debugging[/glow]
        Serial.println("");
9  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: String(?) error on: December 19, 2010, 06:07:01 pm
here is my code now.... still don't working, but i'll continue tomorrow.

Code:

//*******************************

#include <SPI.h>
#include <Ethernet.h>

/*
Simple Ethernet Test
Arduino server outputs simple text to browser
and controlling LED with simple checkbox
The circuit:
* Arduino Duemilanove
* Arduino Ethernet shield
* Basic FTDI breakout 5V  
* LED connected to GND and digital pin 4 via resistor
By Minde
http://www.sciencprog.com/
*/

 byte    mac[] =     { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };   //physical mac address
 byte    ip[] =      { 192, 168, 2, 110 };                     // ip in lan
 byte    gateway[] = { 192, 168, 2, 1 };                       // internet access via router
 byte    subnet[] =  { 255, 255, 255, 0 };                     //subnet mask
 Server  server(80);                // server port
 int     ledPin = 4;                // LED pin
 int     heatpin = 5;               // Heating *relay*
 int     sensorPin = A0; // analog in 1 for testing
 int     sensorValue = 0;
 char    link[]= "";                // link data
 String  readString = String(30);   // string for fetching data from address
 boolean LEDON = false;             // LED status flag
 boolean HEATON = false;             // Heat status flag
 

void setup()
{    
  Serial.begin(57600); //enable serial datada print
  Ethernet.begin(mac, ip, gateway, subnet); //start Ethernet
  
  pinMode(ledPin, OUTPUT); //Set pin 4 to output
  pinMode(heatpin, OUTPUT);
  Serial.print("Starter server");
  
  sensorValue = analogRead(sensorPin);
  Serial.println("");
  Serial.println (sensorValue);

}

void loop(){

  Client client = server.available();  // Create a client connection
    if (client) {
      while (client.connected()) {
        if (client.available()) {

          char c = client.read();

        if (readString.length() < 30) { //read char by char HTTP request
          readString.concat(c); } //store characters to string
          
        Serial.print(c); //output chars to serial port for debugging



        if (c == '\n') { //if HTTP request has ended
        
        



          //lets check if LED should be lighted
          if (readString.substring(c) == "L=1") { //led has to be turned ON
              digitalWrite(ledPin, HIGH); // set the LED on
              Serial.println("ledpin på");
              LEDON = true;
          }

          if (readString.substring(c)== "L=0") {
            //led has to be turned OFF
            digitalWrite(ledPin, LOW); // set the LED OFF
            Serial.println("ledpin av");
            LEDON = false;
           }
          
          
          if (readString.substring(c) == "H=1") { //heat has to be turned ON
              digitalWrite(heatpin, HIGH); // set the heat on
              Serial.println("heatpin på");
              HEATON = true;
          }

          if (readString.substring(c) == "H=0") {
            //heat has to be turned OFF
            digitalWrite(heatpin, LOW); // set the heat OFF
            Serial.println("heatpin av");
            HEATON = false;
           }
          
          
          
          


client.println("HTTP/1.1 200 OK"); // now output HTML data starting with standart header
client.println("Content-Type: text/html");
client.println();
client.print  ("<body style=background-color:white>"); //set background to white

// HTML Code

client.println("<font color='red'><h1>Arduino fjernstyringsside</font></h1>");//send first heading
client.println("<hr />");
client.println("<font color='blue' size='5[ch8242]>Analog input: "); //output some sample data to browser
  sensorValue = analogRead(sensorPin);


client.print(sensorValue);//lets output some data
Serial.print(sensorValue);

client.println("<br />");//some space between lines
client.println("<hr />");
client.println("<font color='green'>Simple table: "); //drawing simple table
client.println("<br />");
client.println("<table border=1><tr><td>row 1, cell 1</td><td>row 1, cell 2</td></tr>");
client.println("<tr><td>row 2, cell 1</td><td>row 2, cell 2</td></tr></table>");

client.println("<br />");
client.println("<hr />");


//controlling led via checkbox
client.println("<h1>LED control</h1>");

//address will look like http://192.168.1.110/?L=1 when submited
client.println("<form method=get name=LED> <input type='radio' name='L' value='1'>LED ON<br><input type='radio' name='L' value='0'>LED OFF<br><input type='radio' name='H' value='1'>HEAT ON<br><input type='radio' name='H' value='0'>HEAT OFF<br><input type=submit value=submit></form>");

client.println("<br />");
//printing LED status
client.print("<font size='5[ch8242]>LED status: ");
  if (LEDON == true) {
     client.println("<font color='green' size='5[ch8242]>ON");
     Serial.print("led på");
 }
  else {
    client.println("<font color='grey' size='5[ch8242]>OFF");
   }

client.println("<hr />");
client.println("<hr />");
client.println("</body></html>");
//clearing string for next read
readString="";

//stopping client

client.stop();

Serial.println("Stopper klient");

}}}}}
10  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: String(?) error on: December 19, 2010, 05:55:19 pm
i have been testing the code a little to get an idea of whats going in and out... so i have putted some serial.print in the code.

Code:
Starter server //start the server

GET / HTTP/1.1 //without any choises marked
Stopper klient

GET /?L=1 HTTP/1.1 // with light marked on
Stopper klient  //stopping client at end of code


the GET part is what i get out from the concat(c) (c is printed over serial)



11  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: String(?) error on: December 19, 2010, 03:48:39 pm
the code compile, and i get the analog input to show up on the output web site.

but i can't get the substring to read the feedback from the browser.
i have tryed using "if (readString.equalsIgnoreCase("L=0")) {"  and also
"if (readString.substring(30) == "L=0") {" but none of they work...
i think i have to "crawl to the cross" and ask if you can tell me what's wrong
12  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: String(?) error on: December 17, 2010, 10:44:38 am
now i have seen through the code, and searched around a bit, is this more correct code?
Code:

//*******************************

#include <SPI.h>
#include <Ethernet.h>

/*
Simple Ethernet Test
Arduino server outputs simple text to browser
and controlling LED with simple checkbox
The circuit:
* Arduino Duemilanove
* Arduino Ethernet shield
* Basic FTDI breakout 5V  
* LED connected to GND and digital pin 4 via resistor
By Minde
http://www.sciencprog.com/
*/

 byte    mac[] =     { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };   //physical mac address
 byte    ip[] =      { 192, 168, 1, 110 };                     // ip in lan
 byte    gateway[] = { 192, 168, 1, 1 };                       // internet access via router
 byte    subnet[] =  { 255, 255, 255, 0 };                     //subnet mask
 Server  server(80);                // server port
 byte    sampledata=50;             // some sample data – outputs 2 (ascii = 50 DEC)
 int     ledPin = 4;                // LED pin
 int     heatpin = 5;               // Heating *relay*
 char    link[]= "";                // link data
 String  readString = String(30);   // string for fetching data from address
 boolean LEDON = false;             // LED status flag
 boolean HEATON = false;             // Heat status flag

void setup()
{    
  Serial.begin(57600); //enable serial datada print
  Ethernet.begin(mac, ip, gateway, subnet); //start Ethernet
  
  pinMode(ledPin, OUTPUT); //Set pin 4 to output
  Serial.print("Starter server");
}

void loop(){

  Client client = server.available();  // Create a client connection
    if (client) {
      while (client.connected()) {
        if (client.available()) {

          char c = client.read();

        if (readString.length() < 30) { //read char by char HTTP request
          readString.concat(c); } //store characters to string
          
        Serial.print(c); //output chars to serial port for debugging



        if (c == '\n') { //if HTTP request has ended


          //lets check if LED should be lighted
          if (readString.equalsIgnoreCase("L=1")) { //led has to be turned ON
              digitalWrite(ledPin, HIGH); // set the LED on
              LEDON = true;
          }

          if (readString.equalsIgnoreCase("L=0")) {
            //led has to be turned OFF
            digitalWrite(ledPin, LOW); // set the LED OFF
            LEDON = false;
           }
          
          
          if (readString.equalsIgnoreCase("H=1")) { //heat has to be turned ON
              digitalWrite(heatpin, HIGH); // set the heat on
              HEATON = true;
          }

          if (readString.equalsIgnoreCase("H=0")) {
            //heat has to be turned OFF
            digitalWrite(heatpin, LOW); // set the heat OFF
            HEATON = false;
           }
          
          
          
          


client.println("HTTP/1.1 200 OK"); // now output HTML data starting with standart header
client.println("Content-Type: text/html");
client.println();
client.print  ("<body style=background-color:white>"); //set background to white

// HTML Code

client.println("<font color='red'><h1>Arduino fjernstyringsside</font></h1>");//send first heading
client.println("<hr />");
client.println("<font color='blue' size='5[ch8242]>Sample data: "); //output some sample data to browser

client.print(sampledata);//lets output some data

client.println("<br />");//some space between lines
client.println("<hr />");
client.println("<font color='green'>Simple table: "); //drawing simple table
client.println("<br />");
client.println("<table border=1><tr><td>row 1, cell 1</td><td>row 1, cell 2</td></tr>");
client.println("<tr><td>row 2, cell 1</td><td>row 2, cell 2</td></tr></table>");

client.println("<br />");
client.println("<hr />");

client.println("<font color='blue' size='5[ch8242]>Link: "); //printing some link
client.print("<a href=");
client.print(link);
client.println(">Visit Scienceprog!</a>");
client.println("<br />");
client.println("<hr />");

//controlling led via checkbox
client.println("<h1>LED control</h1>");

//address will look like http://192.168.1.110/?L=1 when submited
client.println("<form method=get name=LED> <input type='radio' name='L' value='1'>LED ON<br><input type='radio' name='L' value='0'>LED OFF<br><input type='radio' name='H' value='1'>HEAT ON<br><input type='radio' name='H' value='0'>HEAT OFF<br><input type=submit value=submit></form>");

client.println("<br />");
//printing LED status
client.print("<font size='5[ch8242]>LED status: ");
  if (LEDON) {
     client.println("<font color='green' size='5[ch8242]>ON");
   }
  else {
    client.println("<font color='grey' size='5[ch8242]>OFF");
   }

client.println("<hr />");
client.println("<hr />");
client.println("</body></html>");
//clearing string for next read
readString="";

//stopping client

client.stop();

Serial.println("Stopper klient");

}}}}}

still a bit confused...
(i'm still a real newbie)
13  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: String(?) error on: December 16, 2010, 03:13:22 pm
and here is the code:
btw: i use version 21
Code:

//*******************************

#include <SPI.h>
#include <Ethernet.h>

/*
Simple Ethernet Test
Arduino server outputs simple text to browser
and controlling LED with simple checkbox
The circuit:
* Arduino Duemilanove
* Arduino Ethernet shield
* Basic FTDI breakout 5V
* LED connected to GND and digital pin 4 via resistor
By Minde
http://www.sciencprog.com/
*/

 byte    mac[] =     { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };   //physical mac address
 byte    ip[] =      { 192, 168, 1, 110 };                     // ip in lan
 byte    gateway[] = { 192, 168, 1, 1 };                       // internet access via router
 byte    subnet[] =  { 255, 255, 255, 0 };                     //subnet mask
 Server  server(80);                //server port
 byte    sampledata=50;             //some sample data – outputs 2 (ascii = 50 DEC)
 int     ledPin = 4;                // LED pin
 char    link[]= "";                 //link data
 String  readString = String(30);   //string for fetching data from address
 boolean LEDON = false;             //LED status flag

void setup()
{    
  Serial.begin(9600); //enable serial datada print
  Ethernet.begin(mac, ip, gateway, subnet); //start Ethernet
  
  pinMode(ledPin, OUTPUT); //Set pin 4 to output
  Serial.print("Starter server");
}

void loop(){

  Client client = server.available();  // Create a client connection
    if (client) {
      while (client.connected()) {
        if (client.available()) {

          char c = client.read();

        if (readString.length() < 30) { //read char by char HTTP request
          readString.append(c); } //store characters to string
          
        Serial.print(c); //output chars to serial port for debugging



        if (c == '\n') { //if HTTP request has ended


          //lets check if LED should be lighted
          if (readString.contains("L=1")) { //led has to be turned ON
              digitalWrite(ledPin, HIGH); // set the LED on
              LEDON = true;
          }

          if (readString.contains("L=0")) {
            //led has to be turned OFF
            digitalWrite(ledPin, LOW); // set the LED OFF
            LEDON = false;
           }


client.println("HTTP/1.1 200 OK"); // now output HTML data starting with standart header
client.println("Content-Type: text/html");
client.println();
client.print  ("<body style=background-color:white>"); //set background to white

// HTML Code

client.println("<font color='red'><h1>HTTP test routines</font></h1>");//send first heading
client.println("<hr />");
client.println("<font color='blue' size='5[ch8242]>Sample data: "); //output some sample data to browser

client.print(sampledata);//lets output some data

client.println("<br />");//some space between lines
client.println("<hr />");
client.println("<font color='green'>Simple table: "); //drawing simple table
client.println("<br />");
client.println("<table border=1><tr><td>row 1, cell 1</td><td>row 1, cell 2</td></tr>");
client.println("<tr><td>row 2, cell 1</td><td>row 2, cell 2</td></tr></table>");

client.println("<br />");
client.println("<hr />");

client.println("<font color='blue' size='5[ch8242]>Link: "); //printing some link
client.print("<a href=");
client.print(link);
client.println(">Visit Scienceprog!</a>");
client.println("<br />");
client.println("<hr />");

//controlling led via checkbox
client.println("<h1>LED control</h1>");

//address will look like http://192.168.1.110/?L=1 when submited
client.println("<form method=get name=LED> <input type='radio' name='L' value='1'>LED ON<br><input type='radio' name='L' value='0'>LED OFF<br><input type=submit value=submit></form>");

client.println("<br />");
//printing LED status
client.print("<font size='5[ch8242]>LED status: ");
  if (LEDON) {
     client.println("<font color='green' size='5[ch8242]>ON");
   }
  else {
    client.println("<font color='grey' size='5[ch8242]>OFF");
   }

client.println("<hr />");
client.println("<hr />");
client.println("</body></html>");
//clearing string for next read
readString="";

//stopping client

client.stop();

}}}}}
14  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: String(?) error on: December 16, 2010, 03:11:41 pm
if i include "wstring" i get all the error messages as written above, but if i dont include them, i get theese message:

Code:

Arduino_Webserver___VIKTIG.cpp: In function 'void loop()':
Arduino_Webserver___VIKTIG:50: error: 'class String' has no member named 'append'
Arduino_Webserver___VIKTIG:60: error: 'class String' has no member named 'contains'
Arduino_Webserver___VIKTIG:65: error: 'class String' has no member named 'contains'
15  Forum 2005-2010 (read only) / Bugs & Suggestions / String(?) error on: December 15, 2010, 06:08:25 pm
Hi
was going to compile a program that i copyed off the web, but i get the following error message:

Code:
C:\arduino-0021\libraries\String\WString.cpp:34: error: prototype for 'String::String(int)' does not match any in class 'String'
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:39: error: candidates are: String::String(long unsigned int, int)
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:38: error:                 String::String(long int, int)
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:37: error:                 String::String(unsigned int, int)
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:36: error:                 String::String(int, int)
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:35: error:                 String::String(unsigned char)
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:34: error:                 String::String(char)
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:33: error:                 String::String(const String&)
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:32: error:                 String::String(const char*)
C:\arduino-0021\libraries\String\WString.cpp: In constructor 'String::String(const char*)':
C:\arduino-0021\libraries\String\WString.cpp:50: error: '_array' was not declared in this scope
C:\arduino-0021\libraries\String\WString.cpp:52: error: 'setArray' was not declared in this scope
C:\arduino-0021\libraries\String\WString.cpp: In copy constructor 'String::String(const String&)':
C:\arduino-0021\libraries\String\WString.cpp:60: error: '_array' was not declared in this scope
C:\arduino-0021\libraries\String\WString.cpp:61: error: 'clear' was not declared in this scope
C:\arduino-0021\libraries\String\WString.cpp:62: error: 'const class String' has no member named '_array'
C:\arduino-0021\libraries\String\WString.cpp:62: error: 'setArray' was not declared in this scope
C:\arduino-0021\libraries\String\WString.cpp: In member function 'const String& String::operator=(const String&)':
C:\arduino-0021\libraries\String\WString.cpp:77: error: '_array' was not declared in this scope
C:\arduino-0021\libraries\String\WString.cpp:83: error: 'clear' was not declared in this scope
C:\arduino-0021\libraries\String\WString.cpp:84: error: 'const class String' has no member named '_array'
C:\arduino-0021\libraries\String\WString.cpp:84: error: 'setArray' was not declared in this scope
C:\arduino-0021\libraries\String\WString.cpp: At global scope:
C:\arduino-0021\libraries\String\WString.cpp:90: error: prototype for 'const String& String::operator=(const char*)' does not match any in class 'String'
C:\arduino-0021\libraries\String\WString.cpp:70: error: candidate is: const String& String::operator=(const String&)
C:\arduino-0021\libraries\String\WString.cpp:107: error: prototype for 'const String& String::operator+=(const char*)' does not match any in class 'String'
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:44: error: candidate is: const String& String::operator+=(const String&)
C:\arduino-0021\libraries\String\WString.cpp:127: error: prototype for 'const String& String::operator+=(char)' does not match any in class 'String'
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:44: error: candidate is: const String& String::operator+=(const String&)
C:\arduino-0021\libraries\String\WString.cpp:145: error: prototype for 'const String& String::operator+=(int)' does not match any in class 'String'
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:44: error: candidate is: const String& String::operator+=(const String&)
C:\arduino-0021\libraries\String\WString.cpp:159: error: prototype for 'const String& String::operator+=(long int)' does not match any in class 'String'
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:44: error: candidate is: const String& String::operator+=(const String&)
C:\arduino-0021\libraries\String\WString.cpp: In member function 'const String& String::operator+=(const String&)':
C:\arduino-0021\libraries\String\WString.cpp:176: error: '_array' was not declared in this scope
C:\arduino-0021\libraries\String\WString.cpp:179: error: 'setArray' was not declared in this scope
C:\arduino-0021\libraries\String\WString.cpp:183: error: '_array' was not declared in this scope
C:\arduino-0021\libraries\String\WString.cpp:183: error: 'const class String' has no member named '_array'
C:\arduino-0021\libraries\String\WString.cpp: At global scope:
C:\arduino-0021\libraries\String\WString.cpp:191: error: no 'const String& String::append(char)' member function declared in class 'String'
C:\arduino-0021\libraries\String\WString.cpp:196: error: no 'const String& String::append(char*)' member function declared in class 'String'
C:\arduino-0021\libraries\String\WString.cpp:201: error: no 'const String& String::append(const String&)' member function declared in class 'String'
C:\arduino-0021\libraries\String\WString.cpp:206: error: no 'const String& String::append(int, int)' member function declared in class 'String'
C:\arduino-0021\libraries\String\WString.cpp:217: error: no 'const String& String::append(long int, int)' member function declared in class 'String'
C:\arduino-0021\libraries\String\WString.cpp:226: error: no 'const String& String::append(int)' member function declared in class 'String'
C:\arduino-0021\libraries\String\WString.cpp:234: error: no 'const String& String::append(long int)' member function declared in class 'String'
C:\arduino-0021\libraries\String\WString.cpp:323: error: prototype for 'char String::charAt(int)' does not match any in class 'String'
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:57: error: candidate is: char String::charAt(unsigned int) const
C:\arduino-0021\libraries\String\WString.cpp:339: error: prototype for 'void String::setCharAt(int, char)' does not match any in class 'String'
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:71: error: candidate is: void String::setCharAt(unsigned int, char)
C:\arduino-0021\libraries\String\WString.cpp:355: error: prototype for 'boolean String::equals(char*)' does not match any in class 'String'
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:60: error: candidate is: unsigned char String::equals(const String&) const
C:\arduino-0021\libraries\String\WString.cpp:366: error: prototype for 'boolean String::equals(const String&)' does not match any in class 'String'
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:60: error: candidate is: unsigned char String::equals(const String&) const
C:\arduino-0021\libraries\String\WString.cpp:372: error: no 'boolean String::contains(char*)' member function declared in class 'String'
C:\arduino-0021\libraries\String\WString.cpp:380: error: prototype for 'byte* String::getBytes()' does not match any in class 'String'
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:79: error: candidate is: void String::getBytes(unsigned char*, unsigned int)
C:\arduino-0021\libraries\String\WString.cpp:386: error: no 'void String::setArray(const char*)' member function declared in class 'String'
C:\arduino-0021\libraries\String\WString.cpp:396: error: prototype for 'int String::indexOf(int)' does not match any in class 'String'
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:65: error: candidates are: int String::indexOf(const String&, unsigned int) const
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:64: error:                 int String::indexOf(const String&) const
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:63: error:                 int String::indexOf(char, unsigned int) const
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:62: error:                 int String::indexOf(char) const
C:\arduino-0021\libraries\String\WString.cpp:402: error: prototype for 'int String::indexOf(const String&)' does not match any in class 'String'
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:65: error: candidates are: int String::indexOf(const String&, unsigned int) const
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:64: error:                 int String::indexOf(const String&) const
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:63: error:                 int String::indexOf(char, unsigned int) const
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:62: error:                 int String::indexOf(char) const
C:\arduino-0021\libraries\String\WString.cpp:408: error: prototype for 'int String::indexOf(char, int)' does not match any in class 'String'
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:65: error: candidates are: int String::indexOf(const String&, unsigned int) const
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:64: error:                 int String::indexOf(const String&) const
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:63: error:                 int String::indexOf(char, unsigned int) const
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:62: error:                 int String::indexOf(char) const
C:\arduino-0021\libraries\String\WString.cpp:420: error: prototype for 'int String::indexOf(const String&, int)' does not match any in class 'String'
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:65: error: candidates are: int String::indexOf(const String&, unsigned int) const
C:\arduino-0021\hardware\arduino\cores\arduino/WString.h:64:
anyone that understands this cryptic message?
Pages: [1] 2 3