Help

#include <DHT.h>
#include <LiquidCrystal.h>
#include <Wire.h>
#include <Adafruit_BMP085.h>

#define DHTPIN 2 // do not connect to pin 0 or pin 1
#define DHTTYPE DHT11 // Define DHT11 module
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal lcd(8,9,4,5,6,7);
Adafruit_BMP085 bmp;

void setup() {
dht.begin();
bmp.begin();
lcd.begin(16,2);
}

void loop() {

float t = dht.readTemperature();
float h = dht.readHumidity();
float p = bmp.readPressure();
float hpa;

lcd.clear();
lcd.setCursor(0,0);
lcd.print(“T:”);
lcd.print(t,1);
lcd.print(” C”);

lcd.setCursor(9,0);
lcd.print(” H:”);
lcd.print(h,0);
lcd.print(“%”);

hpa = p/100; //convert pascals to hectopascals

lcd.setCursor(0,1);
lcd.print(“P:”);
lcd.print(hpa,0);
lcd.print(” hPa”);
delay (2000);
}

Doesn’t upload

And the full error message is what ?

Please read How to use the forum before you make any attempt to post again please :)

Arduino: 1.8.1 (Windows 10), Board: "Arduino/Genuino Uno"

sketch_may16b:8: error: 'DHTYPE' was not declared in this scope

DHT dht(DHTPIN,DHTYPE);

^

Multiple libraries were found for "DHT.h" Used: C:\Users\Tiago\OneDrive\Documents\Arduino\libraries\DHT_sensor_library Not used: C:\Users\Tiago\OneDrive\Documents\Arduino\libraries\DHT-sensor-library-master exit status 1 'DHTYPE' was not declared in this scope

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

Why didn't you read How to use the Forum?

And why didn't you declare DHTYPE? (what a bull name...)

septillion: Why didn't you read How to use the Forum?

And why didn't you declare DHTYPE? (what a bull name...)

I'm fairly new to Arduino coding, so how do i declare the DHTYPE? thanks

Not answering questions and not acting on it isn't going to get you much help ;)

I’ve now read the how to use this forum, subject line is a bit dull. Probably should have started with reading how to use forum…

I can’t seem to find anything on le google for it too.

#include <SFE_BMP180.h>
#include <DHT.h>
#include <LiquidCrystal.h>
#include <Wire.h>
#include <Adafruit_BMP085.h>

#define DHTPIN 2     // do not connect to pin 0 or pin 1
#define DHTTYPE DHT11   // Define DHT11 module
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal lcd
Adafruit_BMP085 bmp;
#include <DHT.h>
#include <LiquidCrystal.h>
#include <Wire.h>
#include <Adafruit_BMP085.h>

#define DHTPIN 2     // do not connect to pin 0 or pin 1
#define DHTTYPE DHT11   // Define DHT11 module
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal lcd(8,9,4,5,6,7);
Adafruit_BMP085 bmp;

void setup() {
dht.begin();
bmp.begin();
lcd.begin(16,2);
}

void loop() {

float t = dht.readTemperature(); 
float h = dht.readHumidity();
float p = bmp.readPressure();
float hpa;

lcd.clear();
lcd.setCursor(0,0);
lcd.print("T:");
lcd.print(t,1);
lcd.print(" C");

lcd.setCursor(9,0);
lcd.print(" H:");
lcd.print(h,0);
lcd.print("%");

hpa = p/100;      //convert pascals to hectopascals

lcd.setCursor(0,1);
lcd.print("P:");
lcd.print(hpa,0);
lcd.print(" hPa");
delay (2000);
}

These are my error messages:

Arduino: 1.8.1 (Windows 10), Board: "Arduino/Genuino Uno"

ONline:12: error: expected initializer before 'Adafruit_BMP085'

 Adafruit_BMP085 bmp;

 ^

ONline:20: error: redefinition of 'DHT dht'

 DHT dht(DHTPIN, DHTTYPE);

        ^

C:\Users\Tiago\OneDrive\Documents\Arduino\Weather_station\Test_2.0\ONline\ONline.ino:10:5: note: 'DHT dht' previously declared here

 DHT dht(DHTPIN, DHTTYPE);

     ^

Multiple libraries were found for "DHT.h"
 Used: C:\Users\Tiago\OneDrive\Documents\Arduino\libraries\DHT_sensor_library
 Not used: C:\Users\Tiago\OneDrive\Documents\Arduino\libraries\DHT-sensor-library-master
exit status 1
expected initializer before 'Adafruit_BMP085'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

thanks :slight_smile:

I've now read the how to use this forum, subject line is a bit dull. Probably should have started with reading how to use forum...

"How to use this forum - please read."

Difficult to see how it could be clearer.

Perhaps it should be changed to "Sign-up for free beer and bacon sandwiches HERE!!!!"

Thanks, that makes it more readable. If you want more help (from others) it’s a good idea to give it a useful title as well. Because we already know you want help (that’s why you’re here) but we would like to know with what.

And that’s a heck of a lot more errors then in the first post.

Error 1, you don’t end line 11 with a semicolon ( ; )

Error 2, you do the same on line 20 as on line 10. And it even tells you that :wink:

Errors are not gibberish, they most of the time tell you pretty clear what’s wrong, just read and understand them.

@AWOL karma++ :grin:

Thanks for the help!

So i’ve now corrected those old errors and my code looks a bit like this:

#include <DHT.h>
#include <LiquidCrystal.h>
#include <Wire.h>
#include <SFE_BMP180.h>


#define DHTPIN 2     // do not connect to pin 0 or pin 1
#define DHTTYPE DHT11   // Define DHT11 module
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal lcd
SFE_BMP180 bmp

void setup() {
dht.begin();
bmp.begin();
lcd.begin(20,4);
}

void loop() {

float t = dht.readTemperature(); 
float h = dht.readHumidity();
float p = bmp.readPressure();
float hpa;

lcd.clear();
lcd.setCursor(0,0);
lcd.print("T:");
lcd.print(t,1);
lcd.print(" C");

lcd.setCursor(9,0);
lcd.print(" H:");
lcd.print(h,0);
lcd.print("%");

hpa = p/100;      //convert pascals to hectopascals

lcd.setCursor(0,1);
lcd.print("P:");
lcd.print(hpa,0);
lcd.print(" hPa");
delay (2000);
}

I saw a mistake in which i was using the library for a BMP085 sensor when im using a BMP180…

I’m getting different error messages now.
I did some googling and can’t seem to understand what an initializer is?
Do i just type “int”?
To declare do i have to include?
#define?

ONline:11: error: expected initializer before 'SFE_BMP180'

 SFE_BMP180 bmp

 ^

C:\Users\Tiago\OneDrive\Documents\Arduino\Weather_station\Test_2.0\ONline\ONline.ino: In function 'void setup()':

ONline:15: error: 'bmp' was not declared in this scope

 bmp.begin();

 ^

ONline:16: error: 'lcd' was not declared in this scope

 lcd.begin(20,4);

 ^

C:\Users\Tiago\OneDrive\Documents\Arduino\Weather_station\Test_2.0\ONline\ONline.ino: In function 'void loop()':

ONline:23: error: 'bmp' was not declared in this scope

 float p = bmp.readPressure();

           ^

ONline:26: error: 'lcd' was not declared in this scope

 lcd.clear();

 ^

Both the LCD and bmp constructors are missing semi colons. And the LCD constructor is incomplete.

groundFungus: Both the LCD and bmp constructors are missing semi colons. And the LCD constructor is incomplete.

So what do i need to type to be able to finish the LCD constructor?

Maybe (8,9,4,3,2)? Something along those lines?

groundFungus is right. Basically you didn't fix error 1 ;)

And don't just try random things, look it up! The documentation tells you exactly what the parameters mean you need to provide.

Once again thanks

New error now stating that isn't naming a type? Type of what? Slightly confused :o

ONline:10: error: 'LiquidCrystal_I2C' does not name a type

 LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

 ^

C:\Users\Tiago\OneDrive\Documents\Arduino\Weather_station\Test_2.0\ONline\ONline.ino: In function 'void setup()':

ONline:16: error: expected ';' before 'lcd'

 lcd.begin(20,4);

 ^

C:\Users\Tiago\OneDrive\Documents\Arduino\Weather_station\Test_2.0\ONline\ONline.ino: In function 'void loop()':

ONline:23: error: 'class SFE_BMP180' has no member named 'readPressure'

 float p = bmp.readPressure();

               ^

ONline:26: error: 'lcd' was not declared in this scope

 lcd.clear();

 ^

If you change the code, repost it ;)

But it's talking about a type of variable or object. You want to make an object of type "LiquidCrystal_I2C" but the compiler tells you it doesn't know what that is.

Are we to guess what changes that you made to the code to get new errors? Post the new code.

How do you know how the LCD is wired and what its address is? Have you included the right library for an I2C LCD?

Sorry here’s the code.

#include <DHT.h>
#include <LiquidCrystal.h>
#include <Wire.h>
#include <SFE_BMP180.h>


#define DHTPIN 2     // do not connect to pin 0 or pin 1
#define DHTTYPE DHT11   // Define DHT11 module
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
SFE_BMP180 bmp;

void setup() {
dht.begin();
bmp.begin()
lcd.begin(20,4);
}

void loop() {

float t = dht.readTemperature(); 
float h = dht.readHumidity();
float p = bmp.readPressure();
float hpa;

lcd.clear();
lcd.setCursor(0,0);
lcd.print("T:");
lcd.print(t,1);
lcd.print(" C");

lcd.setCursor(9,0);
lcd.print(" H:");
lcd.print(h,0);
lcd.print("%");

hpa = p/100;      //convert pascals to hectopascals

lcd.setCursor(0,1);
lcd.print("P:");
lcd.print(hpa,0);
lcd.print(" hPa");
delay (2000);
}

So all components i’m using and i’ve set them up for a weather station.
I’ve used Visuino before for this and it works great but im not really learning anything from it.
I’d also like to add altitude which doesn’t seem to be possible to get correct values for the visuino.

On the LCD i purchased it came with the LCM1602 which i googled and found a code that would work with it and to be hold it works because i am able to display hello world but i can’t get the sensor’s to work

That is the back story to this mini project of mine which i’m having diffuculty getting to work
thanks :slight_smile:

Do you, by any change, load a different library in the Hello World?

This is the code i’m using in this example

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

On the hello world one it is

LiquidCrystal_I2C lcd(0x27,20,4);

Don’t think the library are different
Both have this library

#include <LiquidCrystal.h>