/* LCD Display with I2C Interface and DHT-22 Temp/Humid Sensor lcd-i2c-temp-humid.ino Use NewLiquidCrystal Library Use DHT Libraries from Adafruit DroneBot Workshop 2018 https://dronebotworkshop.com */ // Include Wire Library for I2C #include <Wire.h> // Include NewLiquidCrystal Library for I2C #include <LiquidCrystal_I2C.h> // Include DHT Libraries from Adafruit // Dependant upon Adafruit_Sensors Library #include "DHT.h"; // Define LCD pinout const int en = 2, rw = 1, rs = 0, d4 = 4, d5 = 5, d6 = 6, d7 = 7, bl = 3; // Define I2C Address - change if reqiuired const int i2c_addr = 0x3F; // DHT-22 #define DHTPIN 7 // DHT-22 Output Pin connection #define DHTTYPE DHT22 // DHT Type is DHT 22 (AM2302) // Define LCD display connections LiquidCrystal_I2C lcd(i2c_addr, en, rw, rs, d4, d5, d6, d7, bl, POSITIVE); // Define Variables float hum; // Stores humidity value in percent float temp; // Stores temperature value in Celcius // Setup DHT sensor for normal 16mhz Arduino DHT dht(DHTPIN, DHTTYPE); void setup() { // Set display type as 16 char, 2 rows lcd.begin(16,2); // Initialize DHT-22 dht.begin(); } void loop() { delay(2000); // Delay so DHT-22 sensor can stabalize hum = dht.readHumidity(); // Get Humidity value temp= dht.readTemperature(); // Get Temperature value // Clear the display lcd.clear(); // Print temperature on top line lcd.setCursor(0,0); lcd.print("Temp: "); lcd.print(temp); lcd.print(" C"); // Print humidity on bottom line lcd.setCursor(0,1); lcd.print("Humid: "); lcd.print(hum); lcd.print(" %");
What errors do you get?
On the line "Define LCD DisplayΒ connections" the error message , POSITIVE was not defined in this scope comes up .
@geeΒ
That means you're using a different LCD library than the original sketch.
I believe that you'll need the version from Francisco Malpartida.
Or, you can switch commands to match the library you already have.
Anything seems possible when you don't know what you're talking about.
Hi WillΒ Β I've tried the "New-LCD Library" by fmalpartida, that was recommended for this sketch and a few others but no luck . Gee
@geeΒ
Did you change the code or just the library ?
Anything seems possible when you don't know what you're talking about.
@gee Try reading the forum, especially the comments with the sketch/video you are using.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@will Seemy reply^^ this was solved a long time ago.Β
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
Got it, thanks.
Anything seems possible when you don't know what you're talking about.
I see someone on the forum had the the same problem . It looks like they used the same library I used and it worked . That was 4 years ago, maybe there has been changes to the library since then .Β
I uploaded the sketch to a different computer and download the recommended library from git hub and it compiled just fine . I think I have to many LCD libraries installed on my other computer and there was a conflict between them ( this my theory anyway ) . I am going to uninstall all the other LCD libraries on my other computer and try again . Thanks to all that replied GeeΒ Β
Yes that was the issue , I deleted 4 other conflicting LCD libraries and the sketch compiled just fine . My Temp. Humid. Gauge is working fine .
Yes that was the issue , I deleted 4 other conflicting LCD libraries and the sketch compiled just fine . My Temp. Humid. Gauge is working fine .
Thanks for the update, I've seen this issue prop up many times here... perhaps Bill (@dronebot-workshop) might want to provide an article update if he hasn't already?
Cheers π