INFO: Dieses Forum nutzt Cookies...
Cookies sind für den Betrieb des Forums unverzichtbar. Mit der Nutzung des Forums erklärst Du dich damit einverstanden, dass wir Cookies verwenden.

Es wird in jedem Fall ein Cookie gesetzt um diesen Hinweis nicht mehr zu erhalten. Desweiteren setzen wir Google Adsense und Google Analytics ein.

Antwort schreiben 
 
Themabewertung:
  • 1 Bewertungen - 5 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
kniffeliger Compilerfehler - ich verzweifle noch....
17.11.2014, 23:13
Beitrag #9
RE: kniffeliger Compilerfehler - ich verzweifle noch....
wenn man nur Harm Geert Mullers Email-Adresse rauskriegen könnte...
Habs bereits probiert, aber
H.Muller@amolf.nl
ist leider ungültig..
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
18.11.2014, 08:42
Beitrag #10
RE: kniffeliger Compilerfehler - ich verzweifle noch....
heya, habe meinen Due bekommen.
Schlechte Nachricht für dein Schachprogramm:
selber Fehler wie bei dir mit dem Due.
mein Mega läuft dagegen mit demselben Programm voll korrekt.

Das wird doch kein ARM-Cortex-Hardware-Konstruktionsfehler sein?
Sowas gabs ja sogar schon mal bei irgendwelchen Intels vor vielen vielen Jahren! 8-)
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
18.11.2014, 19:40
Beitrag #11
RE: kniffeliger Compilerfehler - ich verzweifle noch....
nicht zu glauben, was die Ursache war....

wenn du und ntl auch alle andere mögen, dann testet doch jetzt mal den folgenden Sketch Code auf dem Due (immer noch debug-Stadium ntl):

Code:
/***************************************************************************/
/*                               micro-Max,                                */
/* A chess program smaller than 2KB (of non-blank source), by H.G. Muller  */
/***************************************************************************/
/* version 4.8.l Sketch (1953 characters) features:                                 */
/* - recursive negamax search                                              */
/* - all-capture MVV/LVA quiescence search                                 */
/* - (internal) iterative deepening                                        */
/* - best-move-first 'sorting'                                             */
/* - a hash table storing score and best move                              */
/* - futility pruning                                                      */
/* - king safety through magnetic, frozen king in middle-game              */
/* - R=2 null-move pruning                                                 */
/* - keep hash and repetition-draw detection                               */
/* - better defense against passers through gradual promotion              */
/* - extend check evasions in inner nodes                                  */
/* - reduction of all non-Pawn, non-capture moves except hash move (LMR)   */
/* - full FIDE rules (expt under-promotion) and move-legality checking     */


#define K(A,B) *(int*)(T+A+(B&8)+S*(B&7))
// #define K(A,B) (int)(T+A+(B&8)+S*(B&7))

#define HTsize (1<<8) // (1<<24)
struct HTab {
          int  K,
               V;
          int  X,
               Y,
               D;
        } HTarray[HTsize];           /* hash table, HTsize entries*/
      
      
#define MAXNODES 60000

int  K,  
     Q,
     R,
     J,
     Z;
    
long N,
     I=80000;                         /* I=80000: "infinity score" */ ;                          

int
    M=136,                           /* M=0x88   board system    */
    S=128,                           /* dummy square 0x80, highest valid square =127    */
    turn=16;            

signed char  L,
     pval[]={0,2,2,7,-1,8,12,23},                      /* relative piece values    */
     vector[]={-16,-15,-17,0,1,16,0,1,16,15,17,0,14,18,31,33,0, /* step-vector lists */
          7,-1,11,6,8,3,6},                          /* 1st dir. in vector[] per piece*/
    
     bsetup[]={6,3,5,7,4,5,3,6},                         /* initial piece setup      */
     board[129],                                        /* board: half of 16x8+dummy*/
     T[1035];                                        /* hash translation table   */

signed char  psymbol[]= ".?+nkbrq?*?NKBRQ";

char mfrom, mto;    // current ply from - to
int  EPSQ,
     RemP;           // remove piece




/* recursive minimax search, turn=moving side, n=depth*/

int  Minimax(int  q, int  l, int  score, int  EPC, int  prev, int  hashkey)        
                       /* (q,l)=window, score, EnPass_sqr.*/
                       /* prev=prev.dest; J,Z=hashkeys; return score*/
{
   int  j,
        r,
        m,
        v,
        d,
        h,
        i,
        F,
        G,
        V,
        P,
        f=J,
        g=Z,
        C,
        s;
   signed char  t,
        p,
        upiece,
        x,
        y,
        X,
        Y,
        H,
        B;
  
   struct HTab *a = HTarray + (J + turn * EPC & HTsize-1);   /* lookup pos. in hash table*/

   char sbuf[50];



   q--;                                          /* adj. window: delay bonus */
   turn^=24;                                        /* change sides             */
   d=a->D;
   m=a->V;
   X=a->X;
   Y=a->Y;                  /* resume at stored depth   */
  
   if(a->K-Z|prev|                                  /* miss: other pos. or empty*/
      !(m<=q | X&8&&m>=l | X&S))                   /*   or window incompatible */
      { d=Y=0; }                                /* start iter. from scratch */
  
   X&=~M;                                        /* start at best-move hint  */

   while( d++ < hashkey || d<3                   /* iterative deepening loop */
     || prev&K == I
       && ( N<60000 & d<98                        /* root: deepen upto time   */
          || (K=X, L=Y&~M, d=3)
       )
     )                                          /* time's up: go do best    */
   {
      x=B=X;                                       /* start scan at prev. best */
      h=Y&S;                                       /* request try noncastl. 1st*/
      P=d<3 ? I : Minimax(-l,1-l,-score,S,0,d-3);               /* Search null move         */
      m = (-P<l | R>35) ? ( d>2 ? -I : score ) : -P;            /* Prune or stand-pat       */
      N++;                                         /* node count (for timing)  */
      do
      {
         upiece=board[x];                                   /* scan board looking for   */
         if(upiece & turn)                                  /*  own piece (inefficient!)*/
         {
            r = p = upiece&7;                               /* p = piece type (set r>0) */
            j = vector[p+16];                                 /* first step vector f.piece*/
            while(r = p>2 & r<0 ? -r : -vector[++j] )       /* loop over directions vector[] */
            {
labelA:                                        /* resume normal after best */
               y=x;                            /* (x,y)=move         */
               F=G=S;                          /* (F,G)=castl.R      */
              
               do
               {                                       /* y traverses ray, or:     */
                  H=y=h?Y^h:y+r;                           /* sneak in prev. best move */
                
                  if(y&M)break;                            /* board edge hit           */
                
                  m= EPC-S&board[EPC]&&y-EPC<2&EPC-y<2?I:m;      /* bad castling             */
                
                  if(p<3&y==EPC)H^=16;                           /* shift capt.sqr. H if e.p.*/
                
                  t=board[H];
                
                  if(t&turn|p<3&!(y-x&7)-!t)break;            /* capt. own, bad pawn mode */
                  i=37*pval[t&7]+(t&192);                     /* value of capt. piece t   */
                  m=i<0?I:m;                                  /* K capture                */
                
                  if(m>=l&d>1) goto labelC;                     /* abort on fail high       */
          
                  v=d-1?score:i-p;                             /* MVV/LVA scoring          */
                
                  if(d-!t>1)                               /* remaining depth          */
                  {
                     v=p<6?board[x+8]-board[y+8]:0;                  /* center positional pts.   */
                     board[G]=board[H]=board[x]=0;board[y]=upiece|32;             /* do move, set non-virgin  */
                     if(!(G&M))board[F]=turn+6,v+=50;               /* castling: put R & score  */
                     v-=p-4|R>29?0:20;                              /* penalize mid-game K move */
                    
                     if(p<3)                                        /* pawns:                   */
                     {
                        v-=9*((x-2&M||board[x-2]-upiece)+              /* structure, undefended    */
                               (x+2&M||board[x+2]-upiece)-1            /*        squares plus bias */
                              +(board[x^16]==turn+36))                 /* kling to non-virgin King */
                              -(R>>2);                                 /* end-game Pawn-push bonus */
                         V=y+r+1&S?647-p:2*(upiece&y+16&32);           /* promotion or 6/7th bonus */
                         board[y]+=V;
                         i+=V;                                         /* change piece, add score  */
                     }
                    
                     v+= score+i;
                     V=m>q ? m : q;                           /* new eval and alpha       */
                     J+=K(y+0,board[y])-K(x+0,upiece)-K(H+0,t);
                     Z+=K(y+8,board[y])-K(x+8,upiece)-K(H+8,t)+G -S;  /* update hash key          */
                     C=d-1-(d>5&p>2&!t&!h);
                     C=R>29|d<3|P-I?C:d;                     /* extend 1 ply if in check */
                     do {
                        s=C>2|v>V?-Minimax(-l,-V,-v,         /* recursive eval. of reply */
                                            F,0,C):v;        /* or fail low if futile    */
                     } while( s>q & ++C<d );
                  
                     v=s;
                     if(prev&&K-I&&v+I&&x==K&y==L)              /* move pending & in root:  */
                     {
                        Q=-score-i; EPSQ=F;                            /*   exit if legal & found  */
                        a->D=99;a->V=0;                        /* lock game in hash as draw*/
                        R+=i>>7;
                        return l;                            /* captured non-P material  */
                     }
                     J=f;
                     Z=g;                                    /* restore hash key         */
                     board[G]=turn+6;
                     board[F]=board[y]=0;
                     board[x]=upiece;
                     board[H]=t;                             /* undo move,G can be dummy */
                  }
                  if(v>m)                                  /* new best, update max,best*/
                  {
                     m=v,X=x,Y=y|S&F;                      /* mark double move with S  */
                  }                      
                  if(h)
                  {
                     h=0;
                     goto labelA;                           /* redo after doing old best*/
                  }                
                  if (
                    x+r-y|upiece&32|                             /* not 1st step,moved before*/
                    p>2 & (
                      p-4|j-7||                             /* no P & no lateral K move,*/
                      board[G=x+3^r>>1&7]-turn-6            /* no virgin R in corner G, */
                      || board[G^1] | board[G^2] )          /* no 2 empty sq. next to R */
                    )
                  {
                     t+=p<5;
                  }                                        /* fake capt. for nonsliding*/
                  else F=y;                                /* enable e.p.              */
                
               } while(!t);                               /* if not capt. continue ray*/
        
            }
         }  // (upiece & turn)
    
      } while((x=x+9&~M)-B);                       /* next sqr. of board, wrap */
  
labelC:
      if (m>I-M|m<M-I) d=98;                       /* mate holds to any depth  */
      m= m+I|P==I ? m : 0;                         /* best loses K: (stale)mate*/
    
      if(a->D<99) {                                /* protect game history     */
         a->K=Z;
         a->V=m;
         a->D=d;                       /* always store in hash tab */
         a->X=X|8*(m>q)|S*(m<l);
         a->Y=Y;                       /* move, type (bound/exact),*/
      }
      /* uncomment for Kibitz */
      if(!((N-S)%987)) {      
        sprintf(sbuf, "searched: %d\n",N-S);
        Serial.print(sbuf);
      }
    
   }  // while (iterative deepening loop)                                          

   turn^=24;                                        /* change sides back        */
   mfrom=K; mto=L;
   return m+= m<score;                                  /* delayed-loss bonus       */
}





void chess()
{
   int  score, i;
   char sbuf[50], sbuf2[50];
   char oboard[129];
   char oldto, oldEPSQ;
   char cstring[20];
  
   K=8;
   while(K--)
   {
      board[K]=(board[K+112]=bsetup[K]+8)+8;
      board[K+16]=18;
      board[K+96]=9;                               /* initial board setup*/
      L=8;
      while(L--)board[16*L+K+8]=(K-4)*(K-4)+(L-3.5)*(L-3.5);     /* center-pts table   */
   }                                                             /*(in unused half board[])*/
   N=1035;
   while(N-->M)T[N]=rand()>>9;
  
                                                                /* play loop          */
   while(1)                                              
   {
     N=-1;
    
     Serial.print("\n");
     while(++N<121) {                                            /* print board */
         sprintf(sbuf," %c", N&8 && (N+=7) ? 10 : psymbol[board[N]&15]);
         Serial.print(sbuf);
     }
    
     if(turn==16) sprintf(sbuf,"\n>  WHITE: ");  else sprintf(sbuf,"\n>   BLACK:  ");
     Serial.print(sbuf);
    
     i = 0;      
     strcpy(cstring,"");
     do   {
       while (Serial.available()==0);      
       cstring[i] = Serial.read();    
       if(cstring[i]==13) {
         cstring[i]=0;
         break;
       }
       else i++;
     } while(i < 10);
    
     K=I;
    
     if(cstring[0]!=0) {                                   /* parse entered move */
       K= cstring[0]-16*cstring[1]+799;
       L= cstring[2]-16*cstring[3]+799;
     }  
    
     Serial.print("\n DEBUG cstring : "); Serial.println(cstring);
     sprintf(sbuf,"\n DEBUG K: %d  \n DEBUG L: %d \n",  K, L);
     Serial.print(sbuf);
    
     Serial.println();  Serial.println(cstring);  Serial.println();
    
     memcpy(oboard, board, sizeof(board));
     oldto=mto;
     oldEPSQ=EPSQ;
    
     score=Minimax(-I, I, Q, EPSQ, 1, 3);                              /* think or check & do*/    
     Serial.print("\nscore=");  Serial.println(score);  Serial.println();
  
    // if(ack!=15) {                    
        RemP=S;  
        if(oboard[mto])   RemP=mto;
        if(mto==oldEPSQ)  RemP=oldto;
                                      
        sprintf(sbuf,"\n\nmoved: >> %c%c", 'a'+(mfrom&7),'8'-(mfrom>>4) );
      
        if(oboard[mto]) strcat(sbuf," X ");
        else strcat(sbuf,"-");
      
        sprintf(sbuf2,"%c%c ", 'a'+(mto&7),'8'-(mto>>4&7));
        strcat(sbuf, sbuf2);
        Serial.print(sbuf);
    
        sprintf(sbuf, " (square %d to %d ) \n", mfrom, mto);
        Serial.print("\n\nDEBUG:\n");
        sprintf(sbuf2,"  EPsq: %c%c (%d)\n  RemP: %c%c (%d)",
                         'a'+(EPSQ&7), '8'-(EPSQ>>4&7), EPSQ,
                         'a'+(RemP&7), '8'-(RemP>>4&7), RemP);
        strcat(sbuf, sbuf2);
        Serial.print(sbuf);
        Serial.print("\n\n");
    //  }
    // else printf("\n\nILLEGAL!\n");

   }
}




void setup() {
   Serial.begin(9600);  
}



void loop() {  
   chess();
  
   while(1);
}
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
18.11.2014, 23:03
Beitrag #12
RE: kniffeliger Compilerfehler - ich verzweifle noch....
hahaha, man glaubt es nicht ! Tongue
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
21.11.2014, 02:08
Beitrag #13
RE: kniffeliger Compilerfehler - ich verzweifle noch....
Hy,

hehe, son sch*** hatte ich auch mal bei nem Webserver über ein Ethernetshield.
Dieses Programm Läuft nur auf dem MEGA jedoch nicht auf dem UNO.
Gleiches Programm gleiches Shield aber beim UNO ist die Webseite nicht aufrufbar

Code:
////////////////////////////////////////////////////////////////////////
//ETHERNET SWITCH PROGRAM
////////////////////////////////////////////////////////////////////////
#include <Ethernet.h>
#include <SPI.h>
#include <EEPROM.h>
#include <String.h>
#include "DHT.h"
////////////////////////////////////////////////////////////////////////
//CONFIGURATION
////////////////////////////////////////////////////////////////////////

//IP manual settings
byte ip[] = { 192, 168, 178, 35 };   //Manual setup only
byte gateway[] = { 192, 168, 178, 1}; //Manual setup only
byte subnet[] = { 255, 255, 255, 0 }; //Manual setup only

// if need to change the MAC address (Very Rare)
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

//Ethernet Port
EthernetServer server = EthernetServer(80); //default html port 80

//The number of outputs going to be switched.
int outputQuantity = 10;  //should not exceed 10

//Invert the output of the leds
boolean outputInverted = false; //true or false
// This is done in case the relay board triggers the relay on negative, rather then on positive supply

//Html page refresh
int refreshPage = 60; //default is 10sec.
//Beware that if you make it refresh too fast, the page could become inacessable.

//Display or hide the "Switch on all Pins" buttons at the bottom of page
int switchOnAllPinsButton = false; //true or false

//Button Array
//Just for a note, varables start from 0 to 9, as 0 is counted as well, thus 10 outputs.

// Select the pinout address
int outputAddress[10] = { 13,31,32,33,34,35,36,37,38,39}; //Allocate 10 spaces and name the output pin address.
//PS pin addresses 10, 11, 12 and 13 on the Duemilanove are used for the ethernet shield, therefore cannot be used.
//PS pin addresses 10, 50, 51 and 52 and 53 on the Mega are used for the ethernet shield, therefore cannot be used.
//PS pin addresses 4, are used for the SD card, therefore cannot be used.
//PS. pin address 2 is used for interrupt-driven notification, therefore could not be used.

// Write the text description of the output channel
String buttonText[10] = {
  "Arduino Check LED","Kueche","Bad","Bad Fenster","Schlafzimmer","Bett Lampe","Kleiderschrank","Balkon","Haustuer","Wohnungstuer"};

// Set the output to retain the last status after power recycle.
int retainOutputStatus[10] = {0,0,0,0,0,0,0,0,0,0};//1-retain the last status. 0-will be off after power cut.

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

////////////////////////////////////////////////////////////////////////
//VARIABLES DECLARATION
////////////////////////////////////////////////////////////////////////
int outp = 0;
boolean printLastCommandOnce = false;
boolean printButtonMenuOnce = false;
boolean initialPrint = true;
String allOn = "";
String allOff = "";
boolean reading = false;
boolean outputStatus[10]; //Create a boolean array for the maximum ammount.
String rev = "V5.12";
unsigned long timeConnectedAt;
boolean writeToEeprom = false;
//EthernetClient client;

//Login
String readString;
boolean login = false;

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

#define DHTPIN A0
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);

////////////////////////////////////////////////////////////////////////
//RUN ONCE
////////////////////////////////////////////////////////////////////////
//Beginning of Program
void setup(){
  
  initEepromValues();
  readEepromValues();

  //Set pins as Outputs
  boolean currentState = false;
  for (int var = 0; var < outputQuantity; var++){

    pinMode(outputAddress[var], OUTPUT);      

    //Switch all outputs to either on or off on Startup
    if(outputInverted == true) {
      //digitalWrite(outputAddress[var], HIGH);
      if(outputStatus[var] == 0){currentState = true;}else{currentState = false;} //check outputStatus if off, switch output accordingly
      digitalWrite(outputAddress[var], currentState);
    }
    else{
      //digitalWrite(outputAddress[var], LOW);
      if(outputStatus[var] == 0){currentState = false;}else{currentState = true;}//check outputStatus if off, switch output accordingly
      digitalWrite(outputAddress[var], currentState);
    }
  }
  //Setting up the IP address. Comment out the one you dont need.
  //Ethernet.begin(mac); //for DHCP address. (Address will be printed to serial.)
  Ethernet.begin(mac, ip, gateway, subnet); //for manual setup. (Address is the one configured above.)



  dht.begin();
  server.begin();
  }


////////////////////////////////////////////////////////////////////////
//LOOP
////////////////////////////////////////////////////////////////////////
void loop(){

   checkForClient();
}

////////////////////////////////////////////////////////////////////////
//checkForClient Function
////////////////////////////////////////////////////////////////////////
void checkForClient(){

  EthernetClient client = server.available();

  if (client) {

    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    boolean sentHeader = false;
    boolean login = false; //Passwortabfrage Aktiviert bei "false", Deaktiviert bei "true"
    
    while (client.connected()) {
      if (client.available()) {

        //if header was not set send it
        
         //read user input
        char c = client.read();
        readString.concat(c);
        if(c == '*'){

          printHtmlHeader(client); //call for html header and css
          printLoginTitle(client);
          printHtmlFooter(client);
          //sentHeader = true;
          login = false;
          break;
        }
        
        if(!sentHeader){
          
            printHtmlHeader(client); //call for html header and css
            client.println("<div  class=\"group-wrapper\">");
           // printHtmlButtonTitle(client); //print the button title
            
          //This is for the arduino to construct the page on the fly.
          sentHeader = true;
        }

        //read user input
    //    char c = client.read();

        //if there was reading but is blank there was no reading
        if(reading && c == ' '){
          reading = false;
        }

        //if there is a ? there was user input
        if(c == '?') {
          reading = true; //found the ?, begin reading the info
        }
        if (login==false) {
            if(readString.indexOf("User=TaDa&Pass=1101") > 0) { //Hier Passwort und Username ändern, keine Umlaute und Groß/kleinschreibung beachten
              login = true;

            }
          }    
        
       // if there was user input switch the relevant output
        if(login && reading){
          
          //if user input is H set output to 1
          if(c == 'H') {
            outp = 1;
          }
          
          //if user input is L set output to 0
          if(c == 'L') {
            outp = 0;
          }
          
         switch (c) {

             case '0':
               //add code here to trigger on 0
               triggerPin(outputAddress[0], client, outp);
               break;            
             case '1':
            //add code here to trigger on 1
               triggerPin(outputAddress[1], client, outp);
               break;            
             case '2':
               //add code here to trigger on 2
               triggerPin(outputAddress[2], client, outp);
               break;
             case '3':
               //add code here to trigger on 3
               triggerPin(outputAddress[3], client, outp);
               break;
             case '4':
               //add code here to trigger on 4
               triggerPin(outputAddress[4], client, outp);
               break;
             case '5':
               //add code here to trigger on 5
               triggerPin(outputAddress[5], client, outp);
               //printHtml(client);
               break;
             case '6':
               //add code here to trigger on 6
               triggerPin(outputAddress[6], client, outp);
               break;
             case '7':
               //add code here to trigger on 7
               triggerPin(outputAddress[7], client, outp);
               break;
             case '8':
               //add code here to trigger on 8
               triggerPin(outputAddress[8], client, outp);
               break;
             case '9':
               //add code here to trigger on 9
               triggerPin(outputAddress[9], client, outp);
               break;
            case 'Logout':
              login = false;
              readString="";
              break;
          } //end of switch case

        }//end of switch switch the relevant output

        //if user input was blank
        if (c == '\n' && currentLineIsBlank){
          
          if(login == false)
          {

            printLoginTitle(client);
            printHtmlFooter(client);
            readString="";

          }
          
          printLastCommandOnce = true;
          printButtonMenuOnce = true;
          triggerPin(777, client, outp); //Call to read input and print menu. 777 is used not to update any outputs
          break;
        }
        


        
      }
    }
    
    printHtmlFooter(client); //Prints the html footer

  }
else
   {  //if there is no client
  
      //And time of last page was served is more then a minute.
      if (millis() > (timeConnectedAt + 60000)){          

             if (writeToEeprom == true){
                 writeEepromValues();  //write to EEprom the current output statuses
                 writeToEeprom = false;
             }
            
      }
   }


}


////////////////////////////////////////////////////////////////////////
//triggerPin Function
////////////////////////////////////////////////////////////////////////
//
void triggerPin(int pin, EthernetClient client, int outp){
  //Switching on or off outputs, reads the outputs and prints the buttons  

  //Setting Outputs
  if (pin != 777){

    if(outp == 1) {
      if (outputInverted ==false){
        digitalWrite(pin, HIGH);
      }
      else{
        digitalWrite(pin, LOW);
      }
    }
    if(outp == 0){
      if (outputInverted ==false){
        digitalWrite(pin, LOW);
      }
      else{
        digitalWrite(pin, HIGH);
      }
    }


  }
  //Refresh the reading of outputs
  readOutputStatuses();


  //Prints the buttons
  if (printButtonMenuOnce == true){
    printHtmlButtons(client);
    printButtonMenuOnce = false;
  }

}

////////////////////////////////////////////////////////////////////////
//printHtmlButtons Function
////////////////////////////////////////////////////////////////////////
//print the html buttons to switch on/off channels
void printHtmlButtons(EthernetClient client){

  float h = dht.readHumidity();
  float t = dht.readTemperature();
  
  //Start to create the html table
  client.println("");
  //client.println("<p>");
  client.println("<FORM>");
  client.println("<table border=\"0\" align=\"center\">");
  
  //Printing Temperature
  client.print("<tr>\n");        
  client.print("<td><h4>");
  client.print("Temperatur: ");
  client.print("</h4></td>\n");
  client.print("<td><h4>");
  client.print(t);
  client.print(" &deg;C</h4></td>\n");
  
  //Printing Humidity
  client.print("<tr>\n");        
  client.print("<td><h4>");
  client.print("Feuchtigkeit: ");
  client.print("</h4></td>");            
  client.print("<td><h4>");
  client.print(h);
  client.print(" %</h4></td>");
  
  client.println("</table>");
  client.println("</FORM>");
    
  client.println("<FORM>");
  client.println("<table border=\"0\" align=\"center\">");
  
  //Start printing button by button
  for (int var = 0; var < outputQuantity; var++)  {      

    //set command for all on/off
    allOn += "H";
    allOn += outputAddress[var];
    allOff += "L";
    allOff += outputAddress[var];


    //Print begining of row
    client.print("<tr>\n");        

    //Prints the button Text
    client.print("<td><h4>");
    client.print(buttonText[var]);
    client.print("</h4></td>\n");

    //Prints the ON Buttons
    client.print("<td>");
    //client.print(buttonText[var]);
    client.print("<INPUT TYPE=\"button\" VALUE=\"ON ");
    //client.print(buttonText[var]);
    client.print("\" onClick=\"parent.location='/?H");
    client.print(var);
    client.print("'\"></td>\n");

    //Prints the OFF Buttons
    client.print(" <td><INPUT TYPE=\"button\" VALUE=\"OFF");
    //client.print(var);
    client.print("\" onClick=\"parent.location='/?L");
    client.print(var);
    client.print("'\"></td>\n");

    //Print first part of the Circles or the LEDs

    //Invert the LED display if output is inverted.

    if (outputStatus[var] == true ){                                                            //If Output is ON
      if (outputInverted == false){                                                             //and if output is not inverted
        client.print(" <td><div class='green-circle'><div class='glare'></div></div></td>\n"); //Print html for ON LED
      }
      else{                                                                                    //else output is inverted then
        client.print(" <td><div class='black-circle'><div class='glare'></div></div></td>\n"); //Print html for OFF LED
      }
    }
    else                                                                                      //If Output is Off
    {
      if (outputInverted == false){                                                           //and if output is not inverted
        client.print(" <td><div class='black-circle'><div class='glare'></div></div></td>\n"); //Print html for OFF LED
      }
      else{                                                                                   //else output is inverted then
        client.print(" <td><div class='green-circle'><div class='glare'></div></div></td>\n"); //Print html for ON LED                    
      }
    }  


    //Print end of row
    client.print("</tr>\n");  
  }

  //Display or hide the Print all on Pins Button
  if (switchOnAllPinsButton == false ){  //false = an, true = aus

    //Prints the ON All Pins Button
    client.print("<tr>\n<td><INPUT TYPE=\"button\" VALUE=\"ALL ON");
    client.print("\" onClick=\"parent.location='/?");
    client.print(allOn);
    client.print("'\"></td>\n");

    //Prints the OFF All Pins Button            
    client.print("<td><INPUT TYPE=\"button\" VALUE=\"ALL OFF");
    client.print("\" onClick=\"parent.location='/?");
    client.print(allOff);
    client.print("'\"></td>\n<td></td>\n<td></td>\n</tr>\n");
  }
  
  //Closing the table and form
  client.println("</table>");
  client.println("</FORM>");
  
  //LOGOUT
  //client.print("<h2><a href='/?Logout'>Logout</a>");
  client.print("<h3 align=\"center\"><input type=button onClick=\"location.href='/?Logout'\" value='Logout'></h3>");
  
}

////////////////////////////////////////////////////////////////////////
//readOutputStatuses Function
////////////////////////////////////////////////////////////////////////
//Reading the Output Statuses
void readOutputStatuses(){
  for (int var = 0; var < outputQuantity; var++)  {
    outputStatus[var] = digitalRead(outputAddress[var]);
  }

}

////////////////////////////////////////////////////////////////////////
//readEepromValues Function
////////////////////////////////////////////////////////////////////////
//Read EEprom values and save to outputStatus
void readEepromValues(){
    for (int adr = 0; adr < outputQuantity; adr++)  {
    outputStatus[adr] = EEPROM.read(adr);
    }
}

////////////////////////////////////////////////////////////////////////
//writeEepromValues Function
////////////////////////////////////////////////////////////////////////
//Write EEprom values
void writeEepromValues(){
    for (int adr = 0; adr < outputQuantity; adr++)  {
    EEPROM.write(adr, outputStatus[adr]);
    }

}

////////////////////////////////////////////////////////////////////////
//initEepromValues Function
////////////////////////////////////////////////////////////////////////
//Initialiaze EEprom values
//if eeprom values are not the correct format ie not euqual to 0 or 1 (thus greater then 1) initialize by putting 0
void initEepromValues(){
      for (int adr = 0; adr < outputQuantity; adr++){        
         if (EEPROM.read(adr) > 1){
                EEPROM.write(adr, 0);
         }
       }
}


////////////////////////////////////////////////////////////////////////
//htmlHeader Function
////////////////////////////////////////////////////////////////////////
//Prints html header
void printHtmlHeader(EthernetClient client){
          timeConnectedAt = millis(); //Record the time when last page was served.
          writeToEeprom = true; // page loaded so set to action the write to eeprom
          
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connnection: close");
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<head>");

          // add page title
          client.println("<title>Ethernet Switch by Daniel Coxy</title>");
          client.println("<meta name=\"description\" content=\"Ethernet Switch\"/>");

          // add a meta refresh tag, so the browser pulls again every x seconds:
          client.print("<meta http-equiv=\"refresh\" content=\"");
          client.print(refreshPage);
          client.println("; url=/\">");

          // add other browser configuration
          client.println("<meta name=\"apple-mobile-web-app-capable\" content=\"yes\">");
          client.println("<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"default\">");
          client.println("<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\">");          

          //inserting the styles data, usually found in CSS files.
          client.println("<style type=\"text/css\">");
          client.println("");

          //This will set how the page will look graphically
          client.println("html { height:100%; }");  

          client.println("  body {");
          client.println("    height: 100%;");
          client.println("    margin: 0;");
          client.println("    font-family: helvetica, sans-serif;");
          client.println("    -webkit-text-size-adjust: none;");
          client.println("   }");
          client.println("");
          client.println("body {");
          client.println("    -webkit-background-size: 100% 21px;");
          client.println("    background-color: #c5ccd3;");
          client.println("    background-image:");
          client.println("    -webkit-gradient(linear, left top, right top,");
          client.println("    color-stop(.75, transparent),");
          client.println("    color-stop(.75, rgba(255,255,255,.1)) );");
          client.println("    -webkit-background-size: 7px;");
          client.println("   }");
          client.println("");
          client.println(".view {");
          client.println("    min-height: 100%;");
          client.println("    overflow: auto;");
          client.println("   }");
          client.println("");
          client.println(".header-wrapper {");
          client.println("    height: 44px;");
          client.println("    font-weight: bold;");
          client.println("    text-shadow: rgba(0,0,0,0.7) 0 -1px 0;");
          client.println("    border-top: solid 1px rgba(255,255,255,0.6);");
          client.println("    border-bottom: solid 1px rgba(0,0,0,0.6);");
          client.println("    color: #fff;");
          client.println("    background-color: #8195af;");
          client.println("    background-image:");
          client.println("    -webkit-gradient(linear, left top, left bottom,");
          client.println("    from(rgba(255,255,255,.4)),");
          client.println("    to(rgba(255,255,255,.05)) ),");
          client.println("    -webkit-gradient(linear, left top, left bottom,");
          client.println("    from(transparent),");
          client.println("    to(rgba(0,0,64,.1)) );");
          client.println("    background-repeat: no-repeat;");
          client.println("    background-position: top left, bottom left;");
          client.println("    -webkit-background-size: 100% 21px, 100% 22px;");
          client.println("    -webkit-box-sizing: border-box;");
          client.println("   }");
          client.println("");
          client.println(".header-wrapper h1 {");
          client.println("    text-align: center;");
          client.println("    font-size: 20px;");
          client.println("    line-height: 44px;");
          client.println("    margin: 0;");
          client.println("   }");
          client.println("");
          client.println(".group-wrapper {");
          client.println("    margin: 9px;");
          client.println("    }");
          client.println("");
          client.println(".group-wrapper h2 {");
          client.println("    color: #4c566c;");
          client.println("    font-size: 17px;");
          client.println("    line-height: 0.8;");
          client.println("    font-weight: bold;");
          client.println("    text-shadow: #fff 0 1px 0;");
          client.println("    margin: 20px 10px 12px;");
          client.println("   }");
          client.println("");
          client.println(".group-wrapper h3 {");
          client.println("    color: #4c566c;");
          client.println("    font-size: 12px;");
          client.println("    line-height: 1;");
          client.println("    font-weight: bold;");
          client.println("    text-shadow: #fff 0 1px 0;");
          client.println("    margin: 20px 10px 12px;");
          client.println("   }");
          client.println("");
          client.println(".group-wrapper h4 {");  //Text for description
          client.println("    color: #212121;");
          client.println("    font-size: 14px;");
          client.println("    line-height: 1;");
          client.println("    font-weight: bold;");
          client.println("    text-shadow: #aaa 1px 1px 3px;");
          client.println("    margin: 5px 5px 5px;");
          client.println("   }");
          client.println("");
          client.println(".group-wrapper table {");
          client.println("    background-color: #fff;");
          client.println("    -webkit-border-radius: 10px;");
          client.println("    -moz-border-radius: 10px;");
          client.println("    -khtml-border-radius: 10px;");
          client.println("    border-radius: 10px;");
          client.println("    font-size: 17px;");
          client.println("    line-height: 20px;");
          client.println("    margin: 9px 0 20px;");
          client.println("    border: solid 1px #a9abae;");
          client.println("    padding: 11px 3px 12px 3px;");
          client.println("    margin-left:auto;");
          client.println("    margin-right:auto;");
          client.println("    -moz-transform :scale(1);"); //Code for Mozilla Firefox
          client.println("    -moz-transform-origin: 0 0;");
          client.println("   }");
          client.println("");


          //how the green (ON) LED will look
          client.println(".green-circle {");
          client.println("    display: block;");
          client.println("    height: 23px;");
          client.println("    width: 23px;");
          client.println("    background-color: #0f0;");
          //client.println("    background-color: rgba(60, 132, 198, 0.8);");
          client.println("    -moz-border-radius: 11px;");
          client.println("    -webkit-border-radius: 11px;");
          client.println("    -khtml-border-radius: 11px;");
          client.println("    border-radius: 11px;");
          client.println("    margin-left: 1px;");
          client.println("    background-image: -webkit-gradient(linear, 0% 0%, 0% 90%, from(rgba(46, 184, 0, 0.8)), to(rgba(148, 255, 112, .9)));@");
          client.println("    border: 2px solid #ccc;");
          client.println("    -webkit-box-shadow: rgba(11, 140, 27, 0.5) 0px 10px 16px;");
          client.println("    -moz-box-shadow: rgba(11, 140, 27, 0.5) 0px 10px 16px; /* FF 3.5+ */");
          client.println("    box-shadow: rgba(11, 140, 27, 0.5) 0px 10px 16px; /* FF 3.5+ */");
          client.println("    }");
          client.println("");

          //how the black (off)LED will look
          client.println(".black-circle {");
          client.println("    display: block;");
          client.println("    height: 23px;");
          client.println("    width: 23px;");
          client.println("    background-color: #040;");
          client.println("    -moz-border-radius: 11px;");
          client.println("    -webkit-border-radius: 11px;");
          client.println("    -khtml-border-radius: 11px;");
          client.println("    border-radius: 11px;");
          client.println("    margin-left: 1px;");
          client.println("    -webkit-box-shadow: rgba(11, 140, 27, 0.5) 0px 10px 16px;");
          client.println("    -moz-box-shadow: rgba(11, 140, 27, 0.5) 0px 10px 16px; /* FF 3.5+ */");
          client.println("    box-shadow: rgba(11, 140, 27, 0.5) 0px 10px 16px; /* FF 3.5+ */");
          client.println("    }");
          client.println("");

          //this will add the glare to both of the LEDs
          client.println("   .glare {");
          client.println("      position: relative;");
          client.println("      top: 1;");
          client.println("      left: 5px;");
          client.println("      -webkit-border-radius: 10px;");
          client.println("      -moz-border-radius: 10px;");
          client.println("      -khtml-border-radius: 10px;");
          client.println("      border-radius: 10px;");
          client.println("      height: 1px;");
          client.println("      width: 13px;");
          client.println("      padding: 5px 0;");
          client.println("      background-color: rgba(200, 200, 200, 0.25);");
          client.println("      background-image: -webkit-gradient(linear, 0% 0%, 0% 95%, from(rgba(255, 255, 255, 0.7)), to(rgba(255, 255, 255, 0)));");
          client.println("    }");
          client.println("");


          //and finally this is the end of the style data and header
          client.println("</style>");
          client.println("</head>");

          //now printing the page itself
          client.println("<body>");
          client.println("<div class=\"view\">");
          client.println("    <div class=\"header-wrapper\">");
          client.println("      <h1>Ethernet Switch o-IP</h1>");
          client.println("    </div>");

//////

} //end of htmlHeader

////////////////////////////////////////////////////////////////////////
//htmlFooter Function
////////////////////////////////////////////////////////////////////////
//Prints html footer
void printHtmlFooter(EthernetClient client){
    //Set Variables Before Exiting
    printLastCommandOnce = false;
    printButtonMenuOnce = false;
    allOn = "";
    allOff = "";
    
    //printing last part of the html
    client.print("<hr />");
    client.println("\n<h3 align=\"center\">&copy;  Daniel Agocs <br> Dorfen - Dezember - 2013 - ");
    client.println(rev);
    client.println("</h3></div>\n</div>\n</body>\n</html>");

    delay(1); // give the web browser time to receive the data
    client.stop(); // close the connection:
    delay (2); //delay so that it will give time for client buffer to clear and does not repeat multiple pages.
    
} //end of htmlFooter


////////////////////////////////////////////////////////////////////////
//printHtmlButtonTitle Function
////////////////////////////////////////////////////////////////////////
//Prints html button title
/*void printHtmlButtonTitle(EthernetClient client){
          client.println("<div  class=\"group-wrapper\">");
          client.println("    <h2 align=\"center\">Click the Buttons</h2>");
          client.println();
}
*/

////////////////////////////////////////////////////////////////////////
//printLoginTitle Function
////////////////////////////////////////////////////////////////////////
//Prints html button title
void printLoginTitle(EthernetClient client){
  client.println("<div  class=\"group-wrapper\">");
  client.println("<h2 align=\"center\">Welcome Tamara or Daniel</h2>");
  client.println("<h2 align=\"center\">Enter Username & Password</h2>");
  client.println(" </div>");
  client.print("<form action='192.168.178.35/'>"); //change to your IP
  client.print("");
  client.println("    <div class=\"group-wrapper\">");
  client.print("<h2 align=\"center\">Username:</h2>");
  client.print("<h2 align=\"center\"><input name='User' value=''></h2>");
  client.print("<h2 align=\"center\">Password:</h2>");
  client.print("<h2 align=\"center\"><input type='Password' name='Pass' value=''></h2>");
  client.print("</div>");
  client.print("<h2 align=\"center\"><input type='submit' value=' Login '></h2>");
  //client.print("<input type='submit' value=' Login '>");
  client.print("</form>");
  client.println("</head></center>");
}


Ich selbst hab kein Strahl worans liegt....

Greez Wampo
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
22.11.2014, 11:49 (Dieser Beitrag wurde zuletzt bearbeitet: 22.11.2014 11:49 von tito-t.)
Beitrag #14
RE: kniffeliger Compilerfehler - ich verzweifle noch....
ich kenne jetzt nicht die Details, aber das hat wahrscheinlich sicher andere Gründe, da ja beide (Uno und Mega) AVR-Prozessoren sind - allerdings mit unterschiedlich viel RAM.
Alle Beiträge dieses Benutzers finden
Diese Nachricht in einer Antwort zitieren
Antwort schreiben 


Möglicherweise verwandte Themen...
Thema: Verfasser Antworten: Ansichten: Letzter Beitrag
  Wo kann ich hier noch Code spahren? (SPI-,Ethernet-,SD-,GSM-Library) avoid 4 377 05.06.2016 14:16
Letzter Beitrag: avoid
  Compilerfehler mit PROGMEM?!?! Wampo 4 607 15.10.2015 23:50
Letzter Beitrag: Wampo

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste