Loading...
  Show Posts
Pages: [1]
1  Using Arduino / Interfacing w/ Software on the Computer / arduino uno + max6675 ? on: April 24, 2013, 12:29:17 pm
hi

is there a uno compatible library for max6675 thermocouple amp?
2  Using Arduino / LEDs and Multiplexing / Re: IC WL2801 LPD 6803 LPD 8806 on: March 23, 2013, 08:45:50 am
i have two rgb strip with lpd 6803 but one is rgb and one is changed colors bgr... is it possible to make a converter that converts rgb to bgr ..?
3  Using Arduino / Networking, Protocols, and Devices / Re: arduino + usb wifi adapter? on: January 07, 2013, 11:00:34 am
ethernet shield + http://www.ebay.com/itm/7in1-Mini-Wireless-802-11-b-g-n-AP-Client-WIFI-Router-Repeater-Booster-Extender-/370728383867?pt=US_Internal_Network_Cards&hash=item565122357b

gives wifi and more ..


4  Using Arduino / Networking, Protocols, and Devices / arduino + usb wifi adapter? on: January 06, 2013, 11:37:00 am
Is it possible to connect arduino and usb wifi adapter?

http://www.ebay.com/itm/150Mbps-300Mbps-USB-Wifi-Wireless-Adapter-Lan-Network-Internet-Card-w-Antenna-/330790394117?pt=LH_DefaultDomain_0&var=&hash=item4d04a4d905

without or with arduino usb host shield?
its still cheaper than arduino wifi shield...
5  Using Arduino / Programming Questions / Re: need help with dht11 webserver on: December 11, 2012, 03:41:12 pm
 program works in arduino but won`t get connections with sensors
6  Using Arduino / Programming Questions / need help with dht11 webserver on: December 11, 2012, 03:21:43 pm
can anyone finds why arduino older code is not working with newer arduino version?
... program works in arduino but won`t get connections with sensors...

Code:
#include <SPI.h>
#include <Ethernet.h>
#include <dht11.h>
#include <SD.h>


dht11 DHT11;

#define nSensores 3
int puertos[nSensores];
float fHumedades[nSensores];
float fTemperaturas[nSensores];

int nFilas=0;
int nFiles=0;

File file;

int iNVisitas=0;

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xEE, 0xEE };
byte ip[] = { 192,168,1, 177 };

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(666);
void setup()
{
  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  
  Serial.begin(115200);
int puertos[]={2,3,4};

  
   pinMode(10, OUTPUT);
  if (!SD.begin(4))
  {
    Serial.println("Error inicializando SD");
    nFiles=-1;
  }
  else
  {
    nFiles=0;
    Serial.println("SD initializada.");
  }
  
}

void getdata(int iIndice)
{
  int chk = DHT11.read(puertos[iIndice]);
  fHumedades[iIndice]=-1;
  fTemperaturas[iIndice]=-1;
  
  Serial.print("Sensor ");
  Serial.print(iIndice);
  Serial.print(" ");
  switch (chk)
  {
    case 0:  
      fHumedades[iIndice]=(float)DHT11.humidity;
      Serial.print(fHumedades[iIndice], 2);
      Serial.print(" % ");
      fTemperaturas[iIndice]=(float)DHT11.temperature;
      Serial.print(fTemperaturas[iIndice], 2);
      Serial.println(" o C");
        break;
    case -1: Serial.println(" Checksum error"); break;
    case -2: Serial.println(" Time out error"); break;
    default: Serial.println(" Unknown error"); break;
  }

  
}


void loop()
{
  // listen for incoming clients
  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();
        // 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();
          // output the value of each analog input pin
          for(int i=0;i<nSensores;i++){
//          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            client.print("sensor ");
            client.print(i);
            client.print(": ");            
            if(fHumedades[i]==-1)
              client.print(" error leyendo el sensor");
            else
            {
              client.print(fHumedades[i], 2);
              client.print(" % ");
              client.print(fTemperaturas[i], 2);
              client.println(" o C");            
            }
            client.println("<br />");            
          }
          client.print((iNVisitas++)/2);
          client.println(" visitas <br />");

          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();
  }
  else
  {
    //if(nFiles>=0 && file)
    {
       file= SD.open("datalog.txt", FILE_WRITE);
    }
    String data="";
    for(int i=0;i<nSensores;i++)
    {
      getdata(i);
      
      data+=String(nFilas)+";"+String(i)+";"+String((int)fHumedades[i])+";"+String((int)fTemperaturas[i])+"\n";
    }
    if(file)
    {
      file.print(data);
      Serial.print(data);
      file.close();
      nFilas++;
    }
    delay(200);
  }
}
Pages: [1]