I am trying to upload my first sketch, No luck.
I feel like this is a library error? I have added a few different DHT11 libraries to no avail.
Any assistance would be greatly appreciated.
The Arduino board I am using is: ELEGOO MEGA2560 R3.
I followed this guide:
Getting this error:
In file included from /Users/Documents/Arduino/libraries/DHT_sensor_library/DHT_U.cpp:15:0:
/Users/Documents/Arduino/libraries/DHT_sensor_library/DHT_U.h:36:10: fatal error: Adafruit_Sensor.h: No such file or directory
#include <Adafruit_Sensor.h>
^~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: exit status 1
In the interest of being somewhat constructive, I have already added the below Adafruit librarys.
If someone could point me towards the correct library, It would be greatly appreciated.
Since you didn't post all your code in code tags (as pointed out in the pinned post 'How to get the most from this forum' it is impossible to be more helpfull.
Sorry, I haven't seen that post yet. I've only started using the Arduino today. Literally only a few hours & this forum even less. Still getting upto speed. I look out for that post, Thanks.
I think you wanted the original code? Not the error?
Your code is messed up, lot's of invalid chars, misplaced statements. I will clean it up and try to compile.
Still something wrong with DHT, I am not a C++ guy so can't help with this
OH ! it 's must be right , its on the web !
I suggest you start with the library examples and work from there !
Good luck and all the best wishes for a happy NewYear !
When I reinstalled the Library Cherk mentioned, I am getting even more errors.
At this point, I am wondering if I should just delete / re-install everything?
I'm heading to bed now, Will check in again later. Appreciate your help.
/private/var/folders/cq/mwsy0lxj79bdfh1zqpw7hjgr0000gn/T/.arduinoIDE-unsaved20241128-8422-rfodz.q9mj1q/sketch_dec28a/sketch_dec28a.ino:5:5: error: no matching function for call to 'DHT::DHT()'
DHT dht;</liquidcrystal.h></p><p>void setup()
^~~
In file included from /private/var/folders/cq/mwsy0lxj79bdfh1zqpw7hjgr0000gn/T/.arduinoIDE-unsaved20241128-8422-rfodz.q9mj1q/sketch_dec28a/sketch_dec28a.ino:2:0:
/Users/Documents/Arduino/libraries/DHT_kxn/DHT.h:65:3: note: candidate: DHT::DHT(uint8_t, uint8_t, uint8_t)
DHT(uint8_t pin, uint8_t type, uint8_t count = 6);
^~~
/Users/Documents/Arduino/libraries/DHT_kxn/DHT.h:65:3: note: candidate expects 3 arguments, 0 provided
/Users/Documents/Arduino/libraries/DHT_kxn/DHT.h:63:7: note: candidate: constexpr DHT::DHT(const DHT&)
class DHT {
^~~
/Users/Documents/Arduino/libraries/DHT_kxn/DHT.h:63:7: note: candidate expects 1 argument, 0 provided
/Users/Documents/Arduino/libraries/DHT_kxn/DHT.h:63:7: note: candidate: constexpr DHT::DHT(DHT&&)
/Users/Documents/Arduino/libraries/DHT_kxn/DHT.h:63:7: note: candidate expects 1 argument, 0 provided
/private/var/folders/cq/mwsy0lxj79bdfh1zqpw7hjgr0000gn/T/.arduinoIDE-unsaved20241128-8422-rfodz.q9mj1q/sketch_dec28a/sketch_dec28a.ino:5:9: error: expected unqualified-id before '<' token
DHT dht;</liquidcrystal.h></p><p>void setup()
^
/private/var/folders/cq/mwsy0lxj79bdfh1zqpw7hjgr0000gn/T/.arduinoIDE-unsaved20241128-8422-rfodz.q9mj1q/sketch_dec28a/sketch_dec28a.ino: In function 'void loop()':
/private/var/folders/cq/mwsy0lxj79bdfh1zqpw7hjgr0000gn/T/.arduinoIDE-unsaved20241128-8422-rfodz.q9mj1q/sketch_dec28a/sketch_dec28a.ino:12:20: error: 'class DHT' has no member named 'getTemperature'; did you mean 'readTemperature'?
float temp = dht.getTemperature();
^~~~~~~~~~~~~~
readTemperature
/private/var/folders/cq/mwsy0lxj79bdfh1zqpw7hjgr0000gn/T/.arduinoIDE-unsaved20241128-8422-rfodz.q9mj1q/sketch_dec28a/sketch_dec28a.ino:13:19: error: 'class DHT' has no member named 'getHumidity'; did you mean 'readHumidity'?
float humi = dht.getHumidity();
^~~~~~~~~~~
readHumidity
/private/var/folders/cq/mwsy0lxj79bdfh1zqpw7hjgr0000gn/T/.arduinoIDE-unsaved20241128-8422-rfodz.q9mj1q/sketch_dec28a/sketch_dec28a.ino: At global scope:
/private/var/folders/cq/mwsy0lxj79bdfh1zqpw7hjgr0000gn/T/.arduinoIDE-unsaved20241128-8422-rfodz.q9mj1q/sketch_dec28a/sketch_dec28a.ino:23:2: error: expected unqualified-id before '<' token
}</p>
^
Multiple libraries were found for "DHT.h"
Used: /Users/Documents/Arduino/libraries/DHT_kxn
Not used: /Users/Documents/Arduino/libraries/DHT_sensor_library
Multiple libraries were found for "LiquidCrystal.h"
Used: /Users/Documents/Arduino/libraries/LiquidCrystal
Not used: /Users/Library/Arduino15/libraries/LiquidCrystal
exit status 1
Compilation error: no matching function for call to 'DHT::DHT()'
That is the first error. The code was badly copied and pasted, fix all of those errors then fix the DHT constructor, then install the DHT library correctly. Now compile.
I see there's been some childish name calling. If that's not removed, ideally with an apology, by the time I return to the forum, the guilty will be spending some time away from the forum.
Two moderators with time to spare because it's the Christmas holidays is not a good time for name calling on the forum. 2 of you have got 2 day suspensions. Please keep it polite when you return.