Kód: Egész kijelölése
#include "DHT.h"
#define dataPin7
#define DHT22 22
DHT dht(7, DHT22);
void setup() {
Serial.begin(9600);
Serial.print("DHT teszt!");
dht.begin();
}
void loop() {
delay(500);
float t = dht.readTemperature();
float h = dht.readHumidity();
Serial.print("Hőmérséklet = ");
Serial.print(t);
Serial.print("*C");
Serial.print(" Páratartalom = ");
Serial.print(h);
Serial.print("% ");
delay(2000);
}
Arduino Uno
DHT22 AM2302
A hibakód:
előre köszönöm a segítséget.Arduino: 1.8.1 (Windows Server 2008 R2), Board: "Arduino/Genuino Uno"
libraries\DHT-sensor-library-master\DHT.cpp.o (symbol from plugin): In function `DHT::readTemperature(bool, bool)':
(.text+0x0): multiple definition of `DHT::readTemperature(bool, bool)'
sketch\DHT.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\DHT-sensor-library-master\DHT.cpp.o (symbol from plugin): In function `DHT::readTemperature(bool, bool)':
(.text+0x0): multiple definition of `DHT::readHumidity(bool)'
sketch\DHT.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\DHT-sensor-library-master\DHT.cpp.o (symbol from plugin): In function `DHT::readTemperature(bool, bool)':
(.text+0x0): multiple definition of `DHT::DHT(unsigned char, unsigned char, unsigned char)'
sketch\DHT.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\DHT-sensor-library-master\DHT.cpp.o (symbol from plugin): In function `DHT::readTemperature(bool, bool)':
(.text+0x0): multiple definition of `DHT::DHT(unsigned char, unsigned char, unsigned char)'
sketch\DHT.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\DHT-sensor-library-master\DHT.cpp.o (symbol from plugin): In function `DHT::readTemperature(bool, bool)':
(.text+0x0): multiple definition of `DHT::begin()'
sketch\DHT.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\DHT-sensor-library-master\DHT.cpp.o (symbol from plugin): In function `DHT::readTemperature(bool, bool)':
(.text+0x0): multiple definition of `DHT::convertCtoF(float)'
sketch\DHT.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\DHT-sensor-library-master\DHT.cpp.o (symbol from plugin): In function `DHT::readTemperature(bool, bool)':
(.text+0x0): multiple definition of `DHT::convertFtoC(float)'
sketch\DHT.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\DHT-sensor-library-master\DHT.cpp.o (symbol from plugin): In function `DHT::readTemperature(bool, bool)':
(.text+0x0): multiple definition of `DHT::computeHeatIndex(float, float, bool)'
sketch\DHT.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\DHT-sensor-library-master\DHT.cpp.o (symbol from plugin): In function `DHT::readTemperature(bool, bool)':
(.text+0x0): multiple definition of `DHT::expectPulse(bool)'
sketch\DHT.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries\DHT-sensor-library-master\DHT.cpp.o (symbol from plugin): In function `DHT::readTemperature(bool, bool)':
(.text+0x0): multiple definition of `DHT::read(bool)'
sketch\DHT.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.