Ho copiato dal forum questo codice
#include <dht11.h> //For DHT11
#include <OneWire.h> //For DS18B20
const byte DHT11_PIN=8; //DHT11 Signal pin on digital 8
const byte DS18B20_Pin = 2; //DS18B20 Signal pin on digital 2
dht11 DHT;
OneWire ds(DS18B20_Pin); // on digital pin 2
float temperature;
int chk;
void setup()
{
delay(1000); // sempre meglio mettere qui un delay
Serial.begin(9600);
Serial.println();
}
void loop()
{
chk = DHT.read(DHT11_PIN); // READ DATA DHT11
switch (chk)
{
case DHTLIB_OK: //Serial.print("OK,\t % ");
// DISPLAY DATA
Serial.print("Umidita dentro casa : \t ");
Serial.print(DHT.humidity,1);
Serial.println(" %");
Serial.print("Temp. dentro casa : \t ");
Serial.print(DHT.temperature,1);
Serial.println(" C");
break;
case DHTLIB_ERROR_CHECKSUM:
Serial.print("Checksum error,\t");
break;
case DHTLIB_ERROR_TIMEOUT:
Serial.print("Time out error,\t");
break;
default:
Serial.print("Unknown error,\t");
break;
}
//delay(1000); //End DHT11
temperature = getTemp(); //Start DS18B20
Serial.print("Temp. acqua : ");
Serial.print(temperature);
Serial.println(" C");
Serial.println(" ");
delay(1000); //just here to slow down the output so it is easier to read
}
float getTemp()
{ //returns the temperature from one DS18S20 in DEG Celsius
... questa rimane invariata
}
pero mi da questi errori... come mai?
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Mac OS X), Board: "Arduino Mega 2560 or Mega ADK"
sketch_nov22a:7: error: 'dht11' does not name a type
sketch_nov22a.ino: In function 'void loop()':
sketch_nov22a:21: error: 'DHT' was not declared in this scope
sketch_nov22a:24: error: 'DHTLIB_OK' was not declared in this scope
sketch_nov22a:33: error: 'DHTLIB_ERROR_CHECKSUM' was not declared in this scope
sketch_nov22a:36: error: 'DHTLIB_ERROR_TIMEOUT' was not declared in this scope
sketch_nov22a.ino: In function 'float getTemp()':
sketch_nov22a:54: error: expected primary-expression before '...' token
sketch_nov22a:54: error: expected `;' before '...' token
abbiate pazienza ... grazie