HTML aflooptimer

Goeiemiddag mensen

Ik ben momenteel bezig met een projectje met een arduino uno en arduino ethernet shield. Zo ver heb ik deze code om mijn pinnen te regelen:

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

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0E, 0xAF, 0xF6 }; //physical mac address
byte ip[] = { 192, 168, 50, 250 }; // ip in lan
byte gateway[] = { 192, 168, 50, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port

String readString; 

//////////////////////

void setup(){

  pinMode(5, OUTPUT); //pin selected to control
  pinMode(6, OUTPUT); //pin selected to control
  pinMode(7, OUTPUT); //pin selected to control
  pinMode(8, OUTPUT); //pin selected to control
  pinMode(2, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  server.begin();

  //enable serial data print 
  Serial.begin(9600); 
  Serial.println("server multi pin button test 1.0"); // so I can keep track of what is loaded
}

void loop(){
  // Create a client connection
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string 
          readString += c; 
          //Serial.print(c);
        } 

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

          ///////////////
          Serial.println(readString); //print to serial monitor for debuging 

          client.println("HTTP/1.1 200 OK"); //send new page
          client.println("Content-Type: text/html");
          client.println();

          client.println("<HTML>");
          client.println("<HEAD>");
          client.println("<TITLE>Domotica Control Panel</TITLE>");
          client.println("</HEAD>");
          client.println("<BODY>");

          client.println("<H1>Domotica Control Panel</H1>");
          
          // For simple testing, pin 5, 6, 7, and 8 are used in buttons
          // DIY buttons
          client.println("<p>WandContactDoos 1.</p>");
          client.println("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on2;'>");
          client.println("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off3;'>");
          client.println("&nbsp;<input type=submit value='ALL OFF' style=width:100px;height:45px onClick=location.href='/?off3579;'>"); 

          // mousedown buttons
          client.println("<p>WandContactDoos 2.</p>");
          client.println("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on4;'>");
          client.println("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off5;'>");
          client.println("&nbsp;<input type=submit value='ALL OFF' style=width:100px;height:45px onClick=location.href='/?off3579;'>");        
                   
          // mousedown radio buttons
          client.println("<p>WandContactDoos 3.</p>");
          client.println("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on6;'>");
          client.println("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off7;'>");
          client.println("&nbsp;<input type=submit value='ALL OFF' style=width:100px;height:45px onClick=location.href='/?off3579;'>");  
   
          
          // custom buttons
          client.println("<p>WandContactDoos 4.</p>");
          client.println("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on8;'>");
          client.println("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off9;'>");
          client.println("&nbsp;<input type=submit value='ALL OFF' style=width:100px;height:45px onClick=location.href='/?off3579;'>");

          client.println("</BODY>");
          client.println("</HTML>");
 
          delay(1);
          //stopping client
          client.stop();

          ///////////////////// control arduino pin
          if(readString.indexOf('2') >0)//checks for 2
          {
            digitalWrite(5, HIGH);    // set pin 5 high
            Serial.println("Led 5 On");
          }
          if(readString.indexOf('3') >0)//checks for 3
          {
            digitalWrite(5, LOW);    // set pin 5 low
            Serial.println("Led 5 Off");
          }
          
          if(readString.indexOf('4') >0)//checks for 4
          {
            digitalWrite(6, HIGH);    // set pin 6 high
            Serial.println("Led 6 On");
          }
          if(readString.indexOf('5') >0)//checks for 5
          {
            digitalWrite(6, LOW);    // set pin 6 low
            Serial.println("Led 6 Off");
          }
          
           if(readString.indexOf('6') >0)//checks for 6
          {
            digitalWrite(7, HIGH);    // set pin 7 high
            Serial.println("Led 7 On");
          }
          if(readString.indexOf('7') >0)//checks for 7
          {
            digitalWrite(7, LOW);    // set pin 7 low
            Serial.println("Led 7 Off");
          }     
          
            if(readString.indexOf('8') >0)//checks for 8
          {
            digitalWrite(8, HIGH);    // set pin 8 high
            Serial.println("Led 8 On");
          }
          if(readString.indexOf('9') >0)//checks for 9
          {
            digitalWrite(8, LOW);    // set pin 8 low
            Serial.println("Led 8 Off");
          }         
             
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}

Ik heb nu rond gekeken op google en deze forum en ook andere forum's. Maar zo ver heb ik geen voorbeeld of iets wat me verder kon helpen gevonden.

Wat ik precies nog wil maken.

Per WCD een instelbare aflooptimer van 1 min tot 60 min als de timer actief is moet de pin omhoog gaan waar de timer mee verbonden is.

Momenteel is dit me HTML pagina layout:

http://nl.tinypic.com/view.php?pic=301fww2&s=5#.UoXuG_ldCeM Als de foto niet werkt gebruik dan deze link :slight_smile:

Ik wil dus per WCD er achter een vakje hebben waar in ik een tijd kan instellen 1-60 min en dan daarnaast een Start knop.

Ik hoop dat dit genoeg informatie is om te begrijpen wat ik bedoel zo niet laat dan een reply achter met quote met stukje wat je niet snapt.

Cheers pewebob

Ik heb nog een apparaat gevonden die ongeveer laat zien wat ik bedoel alleen dit wil ik dan crearen. Met Arduino UNO/Ethernetshield/HMTL pagina

Link van apparaat:

Cheers Pewebob

Hoi Pewebob.

Die fotosite biedt je de mogelijkheid om IMG tags te kopiëren en rechtstreeks op fora te plaatsen.
Het resultaat is dan als volgt:

Je vraag kan ik niet beantwoorden omdat ik helemaal geen kaas gegeten heb van HTML.
Wel heb ik een ethernet shield maar daar ga ik pas over een hele tijd mee aan de slag als ik een aantal kleinere uitdagingen heb beslecht.

MAS3:
Hoi Pewebob.

Die fotosite biedt je de mogelijkheid om IMG tags te kopiëren en rechtstreeks op fora te plaatsen.
Het resultaat is dan als volgt:

Je vraag kan ik niet beantwoorden omdat ik helemaal geen kaas gegeten heb van HTML.
Wel heb ik een ethernet shield maar daar ga ik pas over een hele tijd mee aan de slag als ik een aantal kleinere uitdagingen heb beslecht.

Hey bedankt voor de tip :smiley: hopelijk kan iemand anders me helpen met html :S

Cheers pewebob

Bump niemand die kan helpen :open_mouth: ????

pewebob:
Bump niemand die kan helpen :open_mouth: ????

Het is me niet duidelijk wat je probleem is. Kan je de html pagina niet maken? Kan je de html pagina info niet naar de arduino sturen? kan je de timer functie niet maken?
Of nog iets anders?
Met vriendelijke groet.
Jantje

Jantje:

pewebob:
Bump niemand die kan helpen :open_mouth: ????

Het is me niet duidelijk wat je probleem is. Kan je de html pagina niet maken? Kan je de html pagina info niet naar de arduino sturen? kan je de timer functie niet maken?
Of nog iets anders?
Met vriendelijke groet.
Jantje

Na wat hulp en zelf aanpassen en uitproberen heb ik uiteindelijk dit:

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

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0E, 0xAF, 0xF6 }; //physical mac address
byte ip[] = { 192, 168, 50, 250 }; // ip in lan
byte gateway[] = { 192, 168, 50, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port

String readString; 

//////////////////////

void setup(){

  pinMode(5, OUTPUT); //pin selected to control
  pinMode(6, OUTPUT); //pin selected to control
  pinMode(7, OUTPUT); //pin selected to control
  pinMode(8, OUTPUT); //pin selected to control
  pinMode(2, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  server.begin();

  //enable serial data print 
  Serial.begin(9600); 
  Serial.println(F("server multi pin button test 1.0")); // so I can keep track of what is loaded
}

void loop(){
  // Create a client connection
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string 
          readString += c; 
          //Serial.print(c);
        } 

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

          ///////////////
          Serial.println(readString); //print to serial monitor for debuging 
          client.println(F("HTTP/1.1 200 OK")); //send new page
          client.println(F("Content-Type: text/html"));
          client.println();

          client.println(F("<HTML>"));
          client.println(F("<HEAD>"));
          client.println(F("<TITLE>Domotica Control Panel</TITLE>"));
          client.println(F("</HEAD>"));
          client.println(F("<BODY>"));

          client.println(F("<H1>Domotica Control Panel</H1>"));
          
          // For simple testing, pin 5, 6, 7, and 8 are used in buttons
          // DIY buttons
          client.println(F("<p>WandContactDoos 1.</p>"));
          client.println(F("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on2;'>"));
          client.println(F("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off3;'>"));
          client.println(F("<input type=submit value='ALL OFF' style=width:100px;height:45px onClick=location.href='/?off3579;'>"));
          client.println(F("&nbsp&nbsp;<input type=submit value='10 Min' style=width:100px;height:45px onClick=location.href='/?off3;'>"));
          client.println(F("<input type=submit value='20 Min' style=width:100px;height:45px onClick=location.href='/?off3;'>"));
          client.println(F("<input type=submit value='40 Min' style=width:100px;height:45px onClick=location.href='/?off3;'>"));
          client.println(F("<input type=submit value='60 Min' style=width:100px;height:45px onClick=location.href='/?off3;'>"));  

          
          client.println(F("<p>WandContactDoos 2.</p>"));
          client.println(F("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on4;'>"));
          client.println(F("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off5;'>"));
          client.println(F("<input type=submit value='ALL OFF' style=width:100px;height:45px onClick=location.href='/?off3579;'>"));
          client.println(F("&nbsp&nbsp;<input type=submit value='10 Min' style=width:100px;height:45px onClick=location.href='/?off5;'>"));
          client.println(F("<input type=submit value='20 Min' style=width:100px;height:45px onClick=location.href='/?off5;'>"));
          client.println(F("<input type=submit value='40 Min' style=width:100px;height:45px onClick=location.href='/?off5;'>"));
          client.println(F("<input type=submit value='60 Min' style=width:100px;height:45px onClick=location.href='/?off5;'>"));
          
          
          client.println(F("<p>WandContactDoos 3.</p>"));
          client.println(F("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on6;'>"));
          client.println(F("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off7;'>"));
          client.println(F("<input type=submit value='ALL OFF' style=width:100px;height:45px onClick=location.href='/?off3579;'>"));
          client.println(F("&nbsp&nbsp;<input type=submit value='10 Min' style=width:100px;height:45px onClick=location.href='/?off7;'>"));
          client.println(F("<input type=submit value='20 Min' style=width:100px;height:45px onClick=location.href='/?off7;'>"));
          client.println(F("<input type=submit value='40 Min' style=width:100px;height:45px onClick=location.href='/?off7;'>"));
          client.println(F("<input type=submit value='60 Min' style=width:100px;height:45px onClick=location.href='/?off7;'>")); 
   
          
          
          client.println(F("<p>WandContactDoos 4.</p>"));
          client.println(F("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on8;'>"));
          client.println(F("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off9;'>"));
          client.println(F("<input type=submit value='ALL OFF' style=width:100px;height:45px onClick=location.href='/?off3579;'>"));
          client.println(F("&nbsp&nbsp;<input type=submit value='10 Min' style=width:100px;height:45px onClick=location.href='/?off9;'>"));
          client.println(F("<input type=submit value='20 Min' style=width:100px;height:45px onClick=location.href='/?off9;'>"));
          client.println(F("<input type=submit value='40 Min' style=width:100px;height:45px onClick=location.href='/?off9;'>"));
          client.println(F("<input type=submit value='60 Min' style=width:100px;height:45px onClick=location.href='/?off9;'>"));

          client.println(F("</BODY>"));
          client.println(F("</HTML>"));
 
          delay(1);
          //stopping client
          client.stop();

          ///////////////////// control arduino pin
          if(readString.indexOf('2') >0)//checks for 2
          {
            digitalWrite(5, HIGH);    // set pin 5 high
            Serial.println("Led 5 On");
          }
          if(readString.indexOf('3') >0)//checks for 3
          {
            digitalWrite(5, LOW);    // set pin 5 low
            Serial.println("Led 5 Off");
          }
          
          if(readString.indexOf('4') >0)//checks for 4
          {
            digitalWrite(6, HIGH);    // set pin 6 high
            Serial.println("Led 6 On");
          }
          if(readString.indexOf('5') >0)//checks for 5
          {
            digitalWrite(6, LOW);    // set pin 6 low
            Serial.println("Led 6 Off");
          }
          
           if(readString.indexOf('6') >0)//checks for 6
          {
            digitalWrite(7, HIGH);    // set pin 7 high
            Serial.println("Led 7 On");
          }
          if(readString.indexOf('7') >0)//checks for 7
          {
            digitalWrite(7, LOW);    // set pin 7 low
            Serial.println("Led 7 Off");
          }     
          
            if(readString.indexOf('8') >0)//checks for 8
          {
            digitalWrite(8, HIGH);    // set pin 8 high
            Serial.println("Led 8 On");
          }
          if(readString.indexOf('9') >0)//checks for 9
          {
            digitalWrite(8, LOW);    // set pin 8 low
            Serial.println("Led 8 Off");
          }         
             
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}

Nu wil alleen nog een delay voor de 10/20/40/60 min knop per WCD1. Dit is alles wat ik eigenlijk nog wil doen maar ik heb al rond gekeken maar niet echt met veel geluk :S. Ik hoop dat jullie me hier verder kunnen helpen.

Cheers pewebob

pewebob
Je vraagstelling blijft heel spaars. Maar goed .... ik heb even naar je code gekeken en je bent duidelijk al een heel eind.
Ik vermoed dat het probleem dat nu overblijft is: de timer functie op Arduino.
Er zijn heel wat libraries die timers makkelijk maken en het zou mij niet verwonderen dat je met zo een librarie het best af bent. Ik ken die libraries niet; dus daar kan ik je niet mee helpen.
Je kan het ook gewoon zelf doen met de millis() functie. Kijk daarvoor eens naar het blink without delay voorbeeld programmaatje.
Maar ik zou in je plaats toch eerst eens googlen naar een timer ibrarie.
Met vriendelijke groet
Jantje

Ik heb heel goede ervaringen mer de TimeAlarm library: TimeAlarms Library, Run Functions At Specific Times. Kun je zowel een alarmtijd als een interval (timer) mee instellen. Lijkt wel te passen bij wat je zoekt.

pjrc = Paul = zeer goede kwaliteit
Jantje

Nerduino:
Ik heb heel goede ervaringen mer de TimeAlarm library: TimeAlarms Library, Run Functions At Specific Times. Kun je zowel een alarmtijd als een interval (timer) mee instellen. Lijkt wel te passen bij wat je zoekt.

Hmm ik heb het bekeken maar ik zou niet weten hoe ik dit kan combineren met een knopje van 10 of 20 of 40 of 60 min :S ik weet niet of jij mischieen een voorbeeld kan geven?

Mvg
pewebob

Hoi mensen ik dacht dit wel zou moeten werken helaas doet het niet helemaal correct maar misschien weten jullie of het wel zou kunnen op deze manier dat ik mischien op verkeerde manier heb geprogrammeerd mischien

Dit is een delay knopje met readstring 10:
Code:
client.println(F("<input type=submit value='20 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off10;'>"));

En dit is dan een led gestuurd via die knop met delay en dit is zelfde led als WCD 4 maar dan via andere readstring
Code:

if(readString.indexOf('10') >0)//checks for 10
{
digitalWrite(5, LOW); // set pin 5 low
Serial.println("Led 8 Off");
delay(10000);
}

Ik ben er mee aan het rond spelen en van alles aan het proberen maar toch nog niet echt iets gevonden hoop dat jullie misschien iets weten.

MVG pewebob

er staat submit value '20 Min' in je html en je zoekt op 10
Je 1O staat tussen enkele quotes (') maar moet tussen dubbele quotes staan (")
enkele quote = een character dubbele quotes is een string

Jantje

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

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0E, 0xAF, 0xF6 }; //physical mac address
byte ip[] = { 192, 168, 50, 250 }; // ip in lan
byte gateway[] = { 192, 168, 50, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port

String readString; 

//////////////////////

void setup(){

  pinMode(5, OUTPUT); //pin selected to control
  pinMode(6, OUTPUT); //pin selected to control
  pinMode(7, OUTPUT); //pin selected to control
  pinMode(8, OUTPUT); //pin selected to control
  pinMode(2, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  server.begin();

  //enable serial data print 
  Serial.begin(9600); 
  Serial.println(F("server multi pin button test 1.0")); // so I can keep track of what is loaded
}

void loop(){
  // Create a client connection
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string 
          readString += c; 
          //Serial.print(c);
        } 

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

          ///////////////
          Serial.println(readString); //print to serial monitor for debuging 
          client.println(F("HTTP/1.1 200 OK")); //send new page
          client.println(F("Content-Type: text/html"));
          client.println();

          client.println(F("<HTML>"));
          client.println(F("<HEAD>"));
          client.println(F("<TITLE>Domotica Control Panel</TITLE>"));
          client.println(F("</HEAD>"));
          client.println(F("<BODY>"));

          client.println(F("<H1>Domotica Control Panel</H1>"));
          
          // For simple testing, pin 5, 6, 7, and 8 are used in buttons
          // DIY buttons
          client.println(F("<p>WandContactDoos 1.</p>"));
          client.println(F("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on2;'>"));
          client.println(F("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off3;'>"));
          client.println(F("<input type=submit value='ALL OFF' style=width:100px;height:45px onClick=location.href='/?off3579;'>"));
          client.println(F("&nbsp&nbsp;<input type=submit value='10 Min' style=width:100px;height:45px onClick=location.href='/?off3;'>"));
          client.println(F("<input type=submit value='20 Min' style=width:100px;height:45px onClick=location.href='/?off3;'>"));
          client.println(F("<input type=submit value='40 Min' style=width:100px;height:45px onClick=location.href='/?off3;'>"));
          client.println(F("<input type=submit value='60 Min' style=width:100px;height:45px onClick=location.href='/?off3;'>"));  

          
          client.println(F("<p>WandContactDoos 2.</p>"));
          client.println(F("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on4;'>"));
          client.println(F("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off5;'>"));
          client.println(F("<input type=submit value='ALL OFF' style=width:100px;height:45px onClick=location.href='/?off3579;'>"));
          client.println(F("&nbsp&nbsp;<input type=submit value='10 Min' style=width:100px;height:45px onClick=location.href='/?off5;'>"));
          client.println(F("<input type=submit value='20 Min' style=width:100px;height:45px onClick=location.href='/?off5;'>"));
          client.println(F("<input type=submit value='40 Min' style=width:100px;height:45px onClick=location.href='/?off5;'>"));
          client.println(F("<input type=submit value='60 Min' style=width:100px;height:45px onClick=location.href='/?off5;'>"));
          
          
          client.println(F("<p>WandContactDoos 3.</p>"));
          client.println(F("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on6;'>"));
          client.println(F("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off7;'>"));
          client.println(F("<input type=submit value='ALL OFF' style=width:100px;height:45px onClick=location.href='/?off3579;'>"));
          client.println(F("&nbsp&nbsp;<input type=submit value='10 Min' style=width:100px;height:45px onClick=location.href='/?off7;'>"));
          client.println(F("<input type=submit value='20 Min' style=width:100px;height:45px onClick=location.href='/?off7;'>"));
          client.println(F("<input type=submit value='40 Min' style=width:100px;height:45px onClick=location.href='/?off7;'>"));
          client.println(F("<input type=submit value='60 Min' style=width:100px;height:45px onClick=location.href='/?off7;'>")); 
   
          
          
          client.println(F("<p>WandContactDoos 4.</p>"));
          client.println(F("<input type=submit value=ON style=width:100px;height:45px onClick=location.href='/?on8;'>"));
          client.println(F("<input type=submit value=OFF style=width:100px;height:45px onClick=location.href='/?off9;'>"));
          client.println(F("<input type=submit value='ALL OFF' style=width:100px;height:45px onClick=location.href='/?off3579;'>"));
          client.println(F("&nbsp&nbsp;<input type=submit value='10 Min' style=width:100px;height:45px onClick=location.href='/?off9;'>"));
          client.println(F("<input type=submit value='20 Min' style=width:100px;height:45px onClick=location.href='/?off9;'>"));
          client.println(F("<input type=submit value='40 Min' style=width:100px;height:45px onClick=location.href='/?off9;'>"));
          client.println(F("<input type=submit value='60 Min' style=width:100px;height:45px onClick=location.href='/?off9;'>"));

          client.println(F("</BODY>"));
          client.println(F("</HTML>"));
 
          delay(1);
          //stopping client
          client.stop();

          ///////////////////// control arduino pin
          if(readString.indexOf('2') >0)//checks for 2
          {
            digitalWrite(5, HIGH);    // set pin 5 high
            Serial.println("Led 5 On");
          }
          if(readString.indexOf('3') >0)//checks for 3
          {
            digitalWrite(5, LOW);    // set pin 5 low
            Serial.println("Led 5 Off");
          }
          
          if(readString.indexOf('4') >0)//checks for 4
          {
            digitalWrite(6, HIGH);    // set pin 6 high
            Serial.println("Led 6 On");
          }
          if(readString.indexOf('5') >0)//checks for 5
          {
            digitalWrite(6, LOW);    // set pin 6 low
            Serial.println("Led 6 Off");
          }
          
           if(readString.indexOf('6') >0)//checks for 6
          {
            digitalWrite(7, HIGH);    // set pin 7 high
            Serial.println("Led 7 On");
          }
          if(readString.indexOf('7') >0)//checks for 7
          {
            digitalWrite(7, LOW);    // set pin 7 low
            Serial.println("Led 7 Off");
          }     
          
            if(readString.indexOf('8') >0)//checks for 8
          {
            digitalWrite(8, HIGH);    // set pin 8 high
            Serial.println("Led 8 On");
          }
          if(readString.indexOf('9') >0)//checks for 9
          {
            digitalWrite(8, LOW);    // set pin 8 low
            Serial.println("Led 8 Off");
          }         
             
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}

ik snap wat je bedoelt snap niet echt wat verschil in effect is maar als ik zo kijk naar me huidige code kijk is dit bij allemaal zo :open_mouth: ??? en die worden wel gewoon goed aangestuurd

er is toch een verschil tussen

if(readString.indexOf('10') >0)

en

if (c == '\n')

Hey jantje ik snap nu wat verschil is als char kan je alleen 1 cijfer gebruiken maar kan je ook Letters gebruiken bijvoorbeeld 'A' of andere letter inplaats vaan een cijfer zoals '3'

enkel aanhalings teken betekend 1 symbool (ook wel teken of character genoemd)
dubbel aanhalings tekens betekend meerdere symbolen na elkaar

Simpel gesteld: een symbool komt overeen met de tekening (vandaar teken) op de knop van je toetsenbord.

Elk symbool komt overeen met een getal. Op arduino is dat een getal van 0 tot 255 of dus een byte (byte = 8 bits)
Dus een symbool is een byte die overeenkomt met een tekening. Een tabel die getallen en symbolen mapt vind je hier http://www.asciitable.com/
Bijvoorbeeld het symbool '1' komt overeen met het decimaal getal 49 (normale mensen werken in het decimaal stelsel)
het getal 0 ( nul niet hoofdletter O) komt overeen met null (hier is geen symbool voor en is een speciaal character).

Zorg dat je het voorgaande goed begrijpt voor je de volgende paragraaf probeert te begrijpen.
C heeft geen speciale type variabele voor strings (= een opeenvolging van characters)
Dit is een probleem omdat je dan niet weet wat het einde is van de string is(het gehele geheugen van je arduino zijn bytes)
Om dat probleem op te lossen heeft men de conventie dat achter de laatste byte een null (dus de waarde 0) staat.
Concreet betekend dit dat als je in je code schrijft.

if(a=='1')

dit door de compiler verstaan wordt als

if(a==49)

Wat is wat je wilt.
terwijl

if(a=="1")

dit door de compiler verstaan wordt als

if(a==[49,0])

En dit is eigenlijk fout.

if(readString.indexOf('10') >0)

Hier heeft de compiler een probleem mee. Dit omdat je met de enkele aanhalingsteken zegt dat het een symbool (byte) is maar aan de andere kant geef je 2 symbolen (bytes) mee.
Arduino IDE staat zo ingesteld dat foutwaarschuwingen niet gegeven worden.

Als toemaatje nog iets over String
String is een C++ oplossing voor het ontbreken van het speciale type variabele voor strings. Maar C++ is 100% compatibel met C (wat wil zeggen dat C code door een C++ compiler kan verwerkt worden).
Dat wil zeggen dat het C probleem blijft bestaan. Meer nog de meeste implementaties vallen uiteindelijk terug op "null om te zeggen dat je aan het einde van de symbolen bent"

Ik hoop dat het wat duidelijker is nu :~

Met vriendelijke groet
Jantje

Hey jantje

Eindelijk een Nederlandse uitleg :smiley: had al rond gezocht wat nou precies verschil is maar meestal haalde ik sommigen termen door elkaar en begreep ik het niet. ik heb nu me readstring verandert naar

if(readString.indexOf("10") >0)
client.println(F("&nbsp&nbsp;<input type=submit value='10 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off10;'>"));

en hier me knop deze hoef ik niet met " toch want deze zoekt naar 10 of zoekt hij nu naar 1 en 0 ? zoals bij mijn all off knop.

client.println(F("<input type=submit value='ALL OFF' style=background:#00FF00;width:100px;height:45px onClick=location.href='/?off3579;'>"));

Deze knop.

nu ik dus weet dat ik me knopjes kan splitsen maar wel zelfde let kan aansturen moet ik alleen nog een delay in die functie crearen. Nu heb ik gemerkt is als je gewoon

delay(10000)

toevoegt je alleen maar 10 sec delay hebt in laden van je html pagina

Ik had ook al libary timer gevonden maar dit is niet om iets te vertragen. Want alles wat ik nodig heb is dat ik op me knopje druk en dat die dan 10/20/40/60 min wacht met het sturen van de opdracht.

Hopelijk is nu beetje duidelijk wat ik bedoel. (gewoon voor zekerheid)

Ik ben zelf weer verder aan het uitproberen met de nieuwe info die ik nu heb en kijk of ik nog andere mogelijk heden kan vinden.

MVG Pewebob

het antwoord op de delay is al gegeven
http://forum.arduino.cc/index.php?topic=199154.msg1485618#msg1485618
probeer dat eerst eens goed uit.
Met vriendelijke groet
Jantje

Ik had did al geprobeerd maar ik krijg alleen zelfde resultaat als normalen delay(xxx)

#include <Time.h>

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

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0E, 0xAF, 0xF6 }; //physical mac address
byte ip[] = { 192, 168, 50, 250 }; // ip in lan
byte gateway[] = { 192, 168, 50, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80); //server port

String readString; 

//////////////////////

void setup(){

  pinMode(5, OUTPUT); //pin selected to control
  pinMode(6, OUTPUT); //pin selected to control
  pinMode(7, OUTPUT); //pin selected to control
  pinMode(8, OUTPUT); //pin selected to control
  pinMode(2, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, gateway, subnet);
  server.begin();

  //enable serial data print 
  Serial.begin(9600); 
  Serial.println(F("server multi pin button test 1.0")); // so I can keep track of what is loaded
}

void loop(){
  // Create a client connection
  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string 
          readString += c; 
          //Serial.print(c);
        } 

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

          ///////////////
          Serial.println(readString); //print to serial monitor for debuging 
          client.println(F("HTTP/1.1 200 OK")); //send new page
          client.println(F("Content-Type: text/html"));
          client.println();

          client.println(F("<HTML>"));
          client.println(F("<HEAD>"));
          client.println(F("<TITLE>Domotica Control Panel</TITLE>"));
          client.println(F("</HEAD>"));
          client.println(F("<BODY style=background-color:#87B4D8>"));

          client.println(F("<H1>Domotica Control Panel</H1>"));
          
          // For simple testing, pin 5, 6, 7, and 8 are used in buttons
          // DIY buttons
          client.println(F("<p>WandContactDoos 1.</p>"));
          client.println(F("<input type=submit value=ON style=background:#FFFFFF;width:100px;height:45px onClick=location.href='/?on2;'>"));
          client.println(F("<input type=submit value=OFF style=background:#FFFFFF;width:100px;height:45px onClick=location.href='/?off3;'>"));
          client.println(F("<input type=submit value='ALL OFF' style=background:#00FF00;width:100px;height:45px onClick=location.href='/?off3579;'>"));
          client.println(F("&nbsp&nbsp;<input type=submit value='10 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off3;'>"));
          client.println(F("<input type=submit value='20 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off3;'>"));
          client.println(F("<input type=submit value='40 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off3;'>"));
          client.println(F("<input type=submit value='60 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off3;'>"));  

          // mousedown buttons
          client.println(F("<p>WandContactDoos 2.</p>"));
          client.println(F("<input type=submit value=ON style=background:#FFFFFF;width:100px;height:45px onClick=location.href='/?on4;'>"));
          client.println(F("<input type=submit value=OFF style=background:#FFFFFF;width:100px;height:45px onClick=location.href='/?off5;'>"));
          client.println(F("<input type=submit value='ALL OFF' style=background:#00FF00;width:100px;height:45px onClick=location.href='/?off3579;'>"));
          client.println(F("&nbsp&nbsp;<input type=submit value='10 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off5;'>"));
          client.println(F("<input type=submit value='20 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off5;'>"));
          client.println(F("<input type=submit value='40 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off5;'>"));
          client.println(F("<input type=submit value='60 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off5;'>"));
          
          // mousedown radio buttons
          client.println(F("<p>WandContactDoos 3.</p>"));
          client.println(F("<input type=submit value=ON style=background:#FFFFFF;width:100px;height:45px onClick=location.href='/?on6;'>"));
          client.println(F("<input type=submit value=OFF style=background:#FFFFFF;width:100px;height:45px onClick=location.href='/?off7;'>"));
          client.println(F("<input type=submit value='ALL OFF' style=background:#00FF00;width:100px;height:45px onClick=location.href='/?off3579;'>"));
          client.println(F("&nbsp&nbsp;<input type=submit value='10 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off7;'>"));
          client.println(F("<input type=submit value='20 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off7;'>"));
          client.println(F("<input type=submit value='40 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off7;'>"));
          client.println(F("<input type=submit value='60 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off7;'>"));
          
   
          
          // custom buttons
          client.println(F("<p>WandContactDoos 4.</p>"));
          client.println(F("<input type=submit value=ON style=background:#FFFFFF;width:100px;height:45px onClick=location.href='/?on8;'>"));
          client.println(F("<input type=submit value=OFF style=background:#FFFFFF;width:100px;height:45px onClick=location.href='/?off9;'>"));
          client.println(F("<input type=submit value='ALL OFF' style=background:#00FF00;width:100px;height:45px onClick=location.href='/?off3579;'>"));
          client.println(F("&nbsp&nbsp;<input type=submit value='10 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off10;'>"));
          client.println(F("<input type=submit value='20 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off9;'>"));
          client.println(F("<input type=submit value='40 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off9;'>"));
          client.println(F("<input type=submit value='60 Min' style=background:#FF0000;width:100px;height:45px onClick=location.href='/?off9;'>"));
          


          client.println(F("</BODY>"));
          client.println(F("</HTML>"));
 
          delay(1);
          //stopping client
          client.stop();

          ///////////////////// control arduino pin
          if(readString.indexOf('2') >0)//checks for 2
          {
            digitalWrite(5, HIGH);    // set pin 5 high
            Serial.println("Led 5 On");
          }
          if(readString.indexOf('3') >0)//checks for 3
          {
            digitalWrite(5, LOW);    // set pin 5 low
            Serial.println("Led 5 Off");
          }
          
          if(readString.indexOf('4') >0)//checks for 4
          {
            digitalWrite(6, HIGH);    // set pin 6 high
            Serial.println("Led 6 On");
          }
          if(readString.indexOf('5') >0)//checks for 5
          {
            digitalWrite(6, LOW);    // set pin 6 low
            Serial.println("Led 6 Off");
          }
          
           if(readString.indexOf('6') >0)//checks for 6
          {
            digitalWrite(7, HIGH);    // set pin 7 high
            Serial.println("Led 7 On");
          }
          if(readString.indexOf('7') >0)//checks for 7
          {
            digitalWrite(7, LOW);    // set pin 7 low
            Serial.println("Led 7 Off");
          }     
          
            if(readString.indexOf('8') >0)//checks for 8
          {
            digitalWrite(8, HIGH);    // set pin 8 high
            Serial.println("Led 8 On");
          }
          if(readString.indexOf('9') >0)//checks for 9
          {
            digitalWrite(8, LOW);    // set pin 8 low
            Serial.println("Led 8 Off");
          }
          if(readString.indexOf("10") >0)//checks for string 10
          {
            digitalWrite(8, LOW);    // set pin 8 low
            Serial.println("Led 8 Off");
            Alarm.delay(10000);
          }         
             
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}

Onder aan de code zie je alarm.delay staan rest is het zelfde als voor heen