DHT22 probléma

Válasz küldése
raczbali
Újonc
Újonc
Hozzászólások: 1
Csatlakozott: 2017. február 20. hétfő, 19:37

DHT22 probléma

Hozzászólás Szerző: raczbali »

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);

}
DHT22 szenzorhoz igyekszek egy alap programot írni. Az apróbb hibáimat már kijavítottam. De a valahol összeakad a program. Több mintaprogrammal is összahísonlítottam, de mégis van benne hiba.

Arduino Uno
DHT22 AM2302

A hibakód:
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.
előre köszönöm a segítséget.
Avatar
Robert
Elektronbűvölő
Hozzászólások: 10191
Csatlakozott: 2005. december 9. péntek, 7:00

Re: DHT22 probléma

Hozzászólás Szerző: Robert »

Legnagyobb hiba:
Arduino: 1.8.1


1.6.5-t próbáld meg és az Adafruit (beépített) library-t használd.
http://www.tavir.hu - a gazda :)
Válasz küldése