HI I'm new to Arduino can you guys help me out , so it be like this , i was looking for soil moisture project to determine the moisture of soil and displayed through LCD display . now i want to combine the soil moisture sensor with LCD display and BME 280 with another display (OLED) but seems like i was having some trouble compiling the codes because i was copy and paste the codes
the codes are shown below
#include <Wire.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
//#define SEALEVELPRESSURE_HPA (1013.25)
#define SEALEVELPRESSURE_HPA (1039.76)
Adafruit_BME280 bme;
void setup() {
Serial.begin(9600);
if (!bme.begin(0x76)) {
Serial.println("Could not find a valid BME280 sensor, check wiring!");
while (1);
}
}
void loop() {
Serial.print("Temperature = ");
Serial.print(bme.readTemperature());
Serial.println("*C");
Serial.print("Pressure = ");
Serial.print(bme.readPressure() / 100.0F);
Serial.println("hPa");
Serial.print("Approx. Altitude = ");
Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
Serial.println("m");
Serial.print("Humidity = ");
Serial.print(bme.readHumidity());
Serial.println("%");
Serial.println();
delay(1000);
}
int sensorPin = A0;
int sensorValue = 0;
int percentValue = 0;
LiquidCrystal_I2C lcd(0x27,16,2);
void setup() {
Serial.begin(9600);
lcd.init();
}
void loop() {
sensorValue = analogRead(sensorPin);
Serial.print("\n\nAnalog Value: ");
Serial.print(sensorValue);
percentValue = map(sensorValue, 1023, 200, 0, 100);
lcd.backlight();
Serial.print("\nPercentValue: ");
Serial.print(percentValue);
Serial.print("%");
lcd.setCursor(0, 0);
lcd.backlight();
lcd.print("Soil Moisture");
lcd.setCursor(0, 1);
lcd.backlight();
lcd.print("Percent: ");
lcd.print(percentValue);
lcd.backlight();
lcd.print("%");
delay(1000);
lcd.clear();
}