Pages: [1]   Go Down
Author Topic: webduino help please !!  (Read 418 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

UK
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2883
Gorm deficient
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

You can't compare strings like this - use strcmp
Logged

Per Arduino ad Astra

Pages: [1]   Go Up
Jump to: