Ayuda ethernet

Hola

de un ejemplo que encontre he añadido un nuevo swich el “yellow” que me hacia falta y no hay forma de que funcione siempre va a “on” lo que copiado exactamente, igual tambien en el NetIO

Alguna idea?

/*

Simple Webserver sketch for NetIO Application

Tutorial on http://netio.davideickhoff.de

*/

#include <SPI.h> 
#include <Ethernet.h>
#define BUFFER 10
// CONFIGURATION 

byte mac[] = { 0x54, 0x55, 0x58, 0x10, 0x00, 0x24 };  // MAC address 84.85.88.16.0.36
byte ip[]  = { 192,168,1,50};                     // ip-address, please change to fit your network
//byte gateway[] = { 192, 168, 1, 1 };                  // Gateway
//byte subnet[]  = { 255, 255, 255, 0 };
//byte dn[] = { 192, 168, 1, 1 };
// example has an RGB diode connected to three pins
int redLed = 47;
int greenLed = 48;
int blueLed = 49;
int yellowLed = 50;
int dipositple = 31;
int h=0;
EthernetServer server(3200);
String readString = String(100);      // string for fetching data from address
int humitat = A8;
void setup(){
  //Ethernet.begin(mac, ip,gateway, subnet,dn);
Ethernet.begin(mac, ip);
    server.begin();

    // configure LED pins
    pinMode(redLed, OUTPUT);
    pinMode(greenLed, OUTPUT);
    pinMode(blueLed, OUTPUT);
    pinMode(yellowLed,OUTPUT);
    pinMode(dipositple, INPUT);
    Serial.begin(9600); 
 }

void loop(){
   h = analogRead(humitat); 
   char comando[BUFFER];
  EthernetClient client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.print(c);
       if (readString.length() < 100) {
            //store characters to string
            readString = readString + c;
        }
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");
          client.println();
          
          
           // conditions for get parameters
          if(readString.indexOf("red=") > -1) {
           digitalWrite(redLed, (readString.indexOf("=1") > -1) ? HIGH : LOW);
          }
          else if(readString.indexOf("green=") > -1) {
           digitalWrite(greenLed, (readString.indexOf("=1") > -1) ? HIGH : LOW);
          } 
          else if(readString.indexOf("blue=") > -1) {
           digitalWrite(blueLed, (readString.indexOf("=1") > -1) ? HIGH : LOW);
          } 
           else if(readString.indexOf("yellow=") > -1) {
           digitalWrite(yellowLed, (readString.indexOf("=1") > -1) ? HIGH : LOW);
          } 
 //if (strstr(comando, "nivell")) 
  if(readString.indexOf("nivell")>-1) //paraula que envia netio
 {client.println("NIVELL DIPOSIT"); 
        if (digitalRead(dipositple) == HIGH) {   
          client.println("CORRECTE");  
        } else {
          client.println("ALARMA"); //digitalWrite(blueLed,HIGH);
       
      }
      client.print ("h=");
      client.println (h);
 }
  if (digitalRead(dipositple) == LOW) { digitalWrite(greenLed,HIGH);}
  
   
          if(readString.indexOf("status=") > -1 ) {
            // status requests
            if (readString.indexOf("red") > -1) 
              client.print(digitalRead(redLed));
            else if (readString.indexOf("green") > -1) 
              client.print(digitalRead(greenLed));
            else if (readString.indexOf("blue") > -1) 
              client.print(digitalRead(blueLed));
              else if (readString.indexOf("yellow") > -1) 
              client.print(digitalRead(yellowLed)); 
            else 
              client.print("invalid parameter");         
          } else if(readString.indexOf("read=") > -1 ) {
            //generic response according to incoming GET parameter
            client.print(String(readString.substring(readString.indexOf("=")+1, readString.indexOf("_"))));
          } else {
            client.println(" CONEXIO OK");
          }

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

          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        } 
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
  }
}

Y del otro lado, que modifcaste?

En NetIo,

simplemente poner una linea mas, cambiando donde pone blue,etc por yellow que es lo que envia NetIO
pongo un imagen de la pantalla el json no lo deja poner

Es una lastima porque solo me falta esto para un proyecto importante controlado por internet

saludos

json.png