Go Down

Topic: webduino help please !! (Read 511 times) previous topic - next topic

loneranger

hi
i have followed all the examples and trying to get get a simple led to light up when some variable are set in the link like so
http://192.168.1.177/reefControl/led?led=on

here is the code
Code: [Select]
URLPARAM_RESULT rc;
  char name[NAMELEN];
  int  name_len;
  char value[VALUELEN];
  int value_len;
  pinMode(13,OUTPUT);
 
  Serial.print("Clock Entered");
  server.httpSuccess();
  if (type == WebServer::GET){
   
     while (strlen(url_tail))
      {
       
      rc = server.nextURLparam(&url_tail, name, NAMELEN, value, VALUELEN);
      Serial.println(name);
      Serial.println(value);
      Serial.println(strlen(name));
          if (name == "led"){
            Serial.print("led High");
            digitalWrite(13,HIGH);
           
        }
      }
  } 


but everytime i go it wont set pin 13 high or even print to the serial led high yet in the serial it displays the name and value so i am guess there is something wrong with the if statement

Groove

Quote
if (name == "led"){
            Serial.print("led High");


You can't compare strings like this - use strcmp
Per Arduino ad Astra

Go Up