Arduino Ethernet


good afternoon

this code graduation project in blow fan , indicator crosses optical sensor, thing that. thing connect ethernet shield, communicating me there line of code not locate to:

  if (digitalread (2) == low)
   {
         conta ++;
         serial.println (conta);
         client.println (conta);
         delay (1000);
     }

i show code, because ubice not work , first result maintained.

code: [select]

  web server
 
 a simple web server shows value of analog input pins.
 using arduino wiznet ethernet shield.
 
 circuit:
 * ethernet shield attached pins 10, 11, 12, 13
 * analog inputs attached pins a0 through a5 (optional)
 
 created 18 dec 2009
 by david a. mellis
 modified 9 apr 2012
 by tom igoe
 
 */

#include <spi.h>
#include <ethernet.h>

// enter mac address , ip address controller below.
// ip address dependent on local network:
byte mac[] = {
  0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed };
ipaddress ip(192,168,1,2);

// initialize ethernet server library
// ip address , port want use
// (port 80 default http):
ethernetserver server(80);
int conta = 0;
void setup() {
 // open serial communications , wait port open:
  serial.begin(9600);
   while (!serial) {
    ; // wait serial port connect. needed leonardo only
  }


  // start ethernet connection , server:
  ethernet.begin(mac, ip);
  server.begin();
  serial.print("server @ ");
  serial.println(ethernet.localip());
}


void loop() {

  // listen incoming clients
  ethernetclient client = server.available();
  if (client) {
    serial.println("new client");
    // http request ends blank line
    boolean currentlineisblank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        serial.write(c);
       
       
        // if you've gotten end of line (received newline
        // character) , line blank, http request has ended,
        // can send reply
        if (c == '\n' && currentlineisblank) {
          // send standard http response header
          client.println("http/1.1 200 ok");
          client.println("content-type: text/html");
          client.println("connection: close");  // connection closed after completion of response
  client.println("refresh: 1");  // refresh page automatically every 5 sec
          client.println();
          client.println("<!doctype html>");
          client.println("<html>");
          // output value of each analog input pin
          (int analogchannel = 0; analogchannel < 1; analogchannel++) {
            int sensorreading = analogread(analogchannel);
           
  if (digitalread(2) == low)
  {
        conta++;
        serial.println(conta);
        delay(100);
    }
 

 
 if (conta<4)
  {
   
    client.println("<body>");
    client.println("<h1 align='center'>espirometro</h1><h3 align='center'>sensor controlado por servidor web con arduino</h3>");
    client.println("<br />");
    client.print("resultado!! - :");
    client.println("<br />");
 
    client.print("muy baja cap");
    client.println("<br />");
   
    client.print("consulta 1 app");
    client.println("<br />");
  }
 
  if (conta>5 && conta<7)
  {
   
    client.print("baja capacidad");
    client.println("<br />");
   
    client.print("consulta 2 app");
    client.println("<br />");
  }
 
  if (conta>8 && conta<20)
  {
   
    client.print("capacidad estable");
    client.println("<br />");
 
    client.print("consulta 3 app");
    client.println("<br />");
  }
          }
          client.println("</html>");
          break;
        }
        if (c == '\n') {
          // you're starting new line
          currentlineisblank = true;
        }
        else if (c != '\r') {
          // you've gotten character on current line
          currentlineisblank = false;
        }
      }
    }
    // give web browser time receive data
    delay(1);
    // close connection:
    client.stop();
    serial.println("client disonnected");
  }
}

code: [select]
    client.println("<br />");
  }
          }
          client.println("</html>");
          break;
        }

does intelligent indenting or crap you? looks crap me.

quote
i show code, because ubice not work , first result maintained.
your translator needs new batteries.


Arduino Forum > Using Arduino > Programming Questions > Arduino Ethernet


arduino

Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code