Go Down

Topic: webduino help please !! (Read 554 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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy