Hello guys, I hope you're doing well. When I add the ADS1115 code to my code, it shows me this error. What can I do with the ADS1115 code not working properly? Without the ADS1115 code, it works properly.
#define BLYNK_DEVICE_NAME ""
#define BLYNK_AUTH_TOKEN ""
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Adafruit_ADS1X15.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
Adafruit_ADS1115 ads0;
Adafruit_ADS1115 ads1;
Adafruit_ADS1115 ads2;
Adafruit_ADS1115 ads3;
#include <DHT.h>
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = ""; // type your wifi name
char pass[] = ""; // type your wifi password
BlynkTimer timer;
#define DHTPIN D5 //Connect Out pin to D2 in NODE MCU
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
int offset = 20;
void sendSensor()
{
float hum = dht.readHumidity();
float temp = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
if (isnan(hum) || isnan(temp)) {
Serial.println("Failed to read DHT sensor!");
return;
}
int16_t adc0, adc1, adc2, adc3;
adc0 = ads0.readADC_SingleEnded(0);
int volt = adc0;
double voltage = map(volt,0,1023, 0, 2500) +offset;
voltage /=100;
// float heat;
// heat = ads0.readADC_SingleEnded(1);
// heat = heat*0.48828125;
//
// float current = 0;
// for(int i = 0; i< 1000; i++){
// current = current +(.100 * ads0.readADC_SingleEnded(2) -25) / 100;
// }
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V0, temp);
Blynk.virtualWrite(V1, hum);
Blynk.virtualWrite(V2, voltage);
// Blynk.virtualWrite(V3, current);
// Blynk.virtualWrite(V4, heat);
Serial.print("Temperature: ");
Serial.print(temp);
Serial.print(" Humidity: ");
Serial.print(hum);
Serial.print(" Voltage: ");
Serial.print(voltage);
Serial.print(" V");
// Serial.print(" Heat: ");
// Serial.print(heat);
// Serial.print(" Current: ");
// Serial.print(current);
// Serial.println(" A");
// Turn on the blacklight and print a message.
lcd.setCursor(0, 0);
lcd.print("Te:");
lcd.print((float)temp);
lcd.print(" H:");
lcd.print((float)hum);
lcd.setCursor(0, 1);
lcd.print("Vo:");
lcd.print((float)voltage);
// lcd.print(" C:");
// lcd.print((float)current);
// lcd.setCursor(1, 1);
delay(1000);
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Wire.begin();
lcd.begin();
lcd.backlight();
ads0.begin();
ads1.begin(0x49);
ads2.begin(0x4a);
ads3.begin(0x4b);
Blynk.begin(auth, ssid, pass);
dht.begin();
timer.setInterval(1000L, sendSensor);
}
void loop() {
// put your main code here, to run repeatedly:
Blynk.run();
timer.run();
}```
