SCD-30 Sensor + OLED
PrateekGoyal18 opened this issue · 10 comments
Hi @paulvha , I am trying to integrate an OLED with a scd30 sensor over esp32, but I am getting some TwoWire errors.
My code is:
#include <Wire.h>
#include <WiFi.h>
#include <esp_wpa2.h>
#include <FirebaseESP32.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include "paulvha_SCD30.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define EAP_ANONYMOUS_IDENTITY "anonymous@iitd.ac.in"
#define EAP_IDENTITY "himangr.visitor@iitd.ac.in"
#define EAP_PASSWORD "epreslab@iitd"
const char* ssid = "IITD_WIFI";
int counter = 0;
WiFiClient client;
int rssi;
String notif_wifi, notif_sensor;
#define FIREBASE_HOST "labindividuallight.firebaseio.com"
#define FIREBASE_AUTH "tQNM1JXaHbrkpyVdavuwayNLnnzi0d4srHk6mptT"
FirebaseData firebaseData;
const long utcOffsetInSeconds = 19800;
String formattedDate, dateStamp, dateStamp_display, dateStamp_firebase, timeStamp, timeStamp_display, timeStamp_firebase;
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "pool.ntp.org", utcOffsetInSeconds);
#define scd_debug 0
#define SCD30_I2C_ADDRESS 0x61
SCD30 scd30;
float temperature, humidity; int co2;
String temp_str, hum_str, co2_str;
Adafruit_SSD1306 display(-1);
#define OLED_I2C_ADDRESS 0x3C
#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
const unsigned char EPRESlogo [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xdc,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xdc, 0x02, 0x00,
0x00, 0x00, 0x08, 0x01, 0xdc, 0x42, 0x00, 0x00, 0x00, 0x00, 0x41, 0x9c, 0x40, 0x00, 0x00, 0x00,
0x1f, 0xc1, 0xbc, 0x40, 0x00, 0x00, 0x00, 0x1f, 0xc0, 0x00, 0x42, 0x00, 0x00, 0x00, 0x1f, 0xc0,
0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f,
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x80,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x80, 0x00, 0x00,
0x00, 0x70, 0x00, 0x19, 0x80, 0x06, 0x00, 0x00, 0x50, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x70,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00,
0x00, 0x22, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41,
0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x41, 0x00, 0x07,
0x77, 0x00, 0x00, 0x00, 0x22, 0x00, 0x1f, 0x27, 0xe0, 0x30, 0x00, 0x1c, 0x00, 0x36, 0x23, 0xa0,
0x20, 0x00, 0x00, 0x00, 0x38, 0x20, 0xe0, 0x3e, 0x00, 0x00, 0x00, 0x10, 0x20, 0x40, 0x87, 0x00,
0x00, 0x20, 0x00, 0x20, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x20, 0x07, 0xe7, 0x00, 0x00, 0x00,
0x00, 0x20, 0x0d, 0x6c, 0x00, 0x06, 0x40, 0x00, 0x00, 0x0f, 0x38, 0x00, 0x07, 0xc0, 0x00, 0x00,
0x2f, 0xf0, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x25, 0xe0, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x14, 0xc0,
0x00, 0x00, 0x0f, 0xe0, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x20, 0x00, 0x86, 0x00, 0x00, 0x00,
0x0b, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x08, 0x20, 0x00, 0x34, 0x00, 0x00, 0x00, 0x0f, 0xe0,
0x00, 0x18, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const unsigned char IITDLogo [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00,
0xdf, 0xff, 0x80, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0x03,
0xf8, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x78, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x1f, 0x00,
0x00, 0x00, 0x78, 0x0d, 0x80, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x20, 0x0c, 0x03, 0x80, 0x00, 0x01,
0xe1, 0x40, 0x01, 0x81, 0xe0, 0x00, 0x03, 0x81, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x03, 0x80, 0x01,
0xc0, 0x00, 0x60, 0x00, 0x07, 0x08, 0x01, 0xe2, 0x00, 0x78, 0x00, 0x0e, 0x00, 0x78, 0x0f, 0x00,
0x38, 0x00, 0x0e, 0x20, 0x60, 0x03, 0x82, 0x18, 0x00, 0x0c, 0x20, 0x40, 0x00, 0x00, 0x1c, 0x00,
0x1c, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x38, 0x06, 0x00, 0x00, 0x30, 0x0e, 0x00, 0x38, 0x06,
0x00, 0x00, 0x38, 0xce, 0x00, 0x38, 0x8c, 0x00, 0x00, 0x18, 0x06, 0x00, 0x70, 0x04, 0x00, 0x00,
0x10, 0x07, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x06,
0x00, 0x30, 0x18, 0x00, 0x00, 0x0c, 0x07, 0x00, 0x73, 0x18, 0x00, 0x80, 0x0c, 0xc7, 0x00, 0x73,
0x18, 0x00, 0x00, 0x0c, 0xc7, 0x00, 0x70, 0x18, 0x00, 0xc0, 0x0c, 0x07, 0x00, 0x30, 0x08, 0x00,
0x00, 0x00, 0x07, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x70, 0x84, 0x00, 0x00, 0x10,
0x07, 0x00, 0x30, 0x8c, 0x00, 0x00, 0x18, 0x06, 0x00, 0x18, 0x86, 0x00, 0x00, 0x38, 0x0e, 0x00,
0x38, 0x46, 0x00, 0x00, 0x31, 0x0e, 0x00, 0x38, 0x40, 0x00, 0x80, 0x01, 0x0e, 0x00, 0x1c, 0x20,
0x00, 0x10, 0x00, 0x18, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x0e, 0x08, 0x00, 0x00,
0x00, 0x38, 0x00, 0x0f, 0x0c, 0x00, 0x00, 0x08, 0x70, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x60,
0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x03, 0xc0, 0x00, 0x01, 0x81, 0xe0, 0x00, 0x00,
0x70, 0x00, 0x06, 0x03, 0x80, 0x00, 0x00, 0x78, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x7c, 0x00,
0x00, 0x1f, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0x03, 0xf8,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x00, 0x00,
0x00, 0x00, 0x0d, 0xec, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
const unsigned char temperatureLogo [] PROGMEM = {
0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x0c, 0x70, 0x00, 0x00, 0x00, 0x18, 0x18, 0x60, 0x00, 0x00,
0x11, 0x88, 0xf0, 0x00, 0x00, 0x32, 0xcc, 0xf0, 0x00, 0x00, 0x26, 0x6c, 0x60, 0x00, 0x00, 0x26,
0x6c, 0x0f, 0x80, 0x00, 0x27, 0xec, 0x18, 0xc0, 0x00, 0x27, 0xec, 0x18, 0xc0, 0x00, 0x26, 0x6c,
0x18, 0x00, 0x00, 0x26, 0x60, 0x18, 0x00, 0x00, 0x26, 0x60, 0x18, 0x00, 0x00, 0x27, 0xe4, 0x18,
0x00, 0x00, 0x26, 0x6c, 0x18, 0x00, 0x00, 0x26, 0x6c, 0x18, 0xc0, 0x00, 0x26, 0x6c, 0x0f, 0x80,
0x00, 0x26, 0x6c, 0x07, 0x00, 0x00, 0x27, 0xec, 0x00, 0x00, 0x00, 0x26, 0x6c, 0x00, 0x00, 0x00,
0x26, 0x6c, 0x00, 0x00, 0x00, 0x26, 0x6c, 0x00, 0x00, 0x00, 0x27, 0xec, 0x00, 0x00, 0x00, 0x26,
0x6c, 0x00, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0xc6, 0x63, 0x00, 0x00, 0x00, 0x8c, 0x31,
0x00, 0x00, 0x01, 0x90, 0x19, 0x80, 0x00, 0x01, 0x30, 0x0c, 0x80, 0x00, 0x03, 0x20, 0x04, 0x80,
0x00, 0x03, 0x20, 0x04, 0xc0, 0x00, 0x03, 0x60, 0x04, 0xc0, 0x00, 0x03, 0x20, 0x04, 0xc0, 0x00,
0x01, 0x20, 0x04, 0x80, 0x00, 0x01, 0x30, 0x0c, 0x80, 0x00, 0x01, 0x80, 0x19, 0x80, 0x00, 0x00,
0x8f, 0xf1, 0x00, 0x00, 0x00, 0x43, 0xc2, 0x00, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x00, 0x1c,
0x38, 0x00, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00
};
const unsigned char humidityLogo [] PROGMEM = {
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xc0, 0x18, 0x00, 0x00, 0x01, 0xe0, 0x2c, 0x00, 0x00,
0x01, 0xe0, 0x64, 0x00, 0x00, 0x03, 0xf0, 0x46, 0x00, 0x00, 0x06, 0xf8, 0x83, 0x00, 0x00, 0x06,
0xf8, 0x09, 0x00, 0x00, 0x0c, 0x7c, 0x0d, 0x80, 0x00, 0x18, 0x3e, 0x06, 0x80, 0x00, 0x18, 0x3e,
0x02, 0xc0, 0x00, 0x30, 0x1f, 0x03, 0x40, 0x00, 0x30, 0x1f, 0x81, 0x60, 0x00, 0x00, 0x0f, 0x81,
0xa0, 0x00, 0x40, 0x07, 0xc0, 0xb0, 0x00, 0xc0, 0x07, 0xc0, 0x90, 0x00, 0x80, 0x03, 0xe0, 0xd0,
0x00, 0x80, 0x03, 0xe0, 0x10, 0x00, 0x3c, 0x03, 0xf0, 0x10, 0x03, 0x7f, 0x07, 0xf0, 0x10, 0x02,
0x63, 0x8e, 0xf8, 0x10, 0x06, 0x43, 0x9d, 0xf8, 0x30, 0x06, 0x63, 0xbb, 0xf8, 0x20, 0x0c, 0x7f,
0x77, 0xfc, 0x40, 0x0c, 0x3c, 0xef, 0x7d, 0x80, 0x0c, 0x00, 0xde, 0x7f, 0x00, 0x08, 0x02, 0x3c,
0x3c, 0x00, 0x08, 0x06, 0x78, 0x3c, 0x00, 0x08, 0x0e, 0xf0, 0x3c, 0x00, 0x08, 0x1d, 0xef, 0x3c,
0x00, 0x0c, 0x3b, 0xdf, 0xfc, 0x00, 0x0c, 0x77, 0xb1, 0xfc, 0x00, 0x04, 0xef, 0x30, 0x78, 0x00,
0x06, 0xde, 0x30, 0xf8, 0x00, 0x03, 0xfc, 0x1f, 0xf0, 0x00, 0x03, 0xf0, 0x0f, 0xf0, 0x00, 0x01,
0xc0, 0x03, 0xe0, 0x00, 0x00, 0xe0, 0x0f, 0xc0, 0x00, 0x00, 0x78, 0x1f, 0x80, 0x00, 0x00, 0x1f,
0xfe, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x00
};
const unsigned char co2Logo [] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x01, 0xa0, 0x00, 0x00,
0x03, 0xe1, 0xe0, 0x00, 0x00, 0x0c, 0x18, 0xc0, 0x00, 0x07, 0xd8, 0x0c, 0x00, 0x00, 0x1c, 0x70,
0x04, 0x00, 0x00, 0x10, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x40, 0x00, 0x02,
0x00, 0x00, 0x40, 0x00, 0x02, 0xe0, 0x00, 0x40, 0x00, 0x03, 0xf8, 0x07, 0x40, 0x00, 0x00, 0x04,
0x1f, 0xc3, 0x87, 0x00, 0x02, 0x20, 0x07, 0xdf, 0x80, 0x03, 0x40, 0x0c, 0x58, 0xc0, 0x01, 0xc0,
0x0c, 0x18, 0xc0, 0x01, 0x80, 0x0c, 0x18, 0xc0, 0x01, 0x80, 0x04, 0xd9, 0x98, 0x01, 0x80, 0x07,
0xcf, 0x3c, 0x01, 0x80, 0x00, 0x00, 0x08, 0x01, 0x80, 0x00, 0x00, 0x38, 0x01, 0xc0, 0x00, 0x00,
0x18, 0x03, 0x40, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x04, 0x1f, 0xff, 0xff, 0xf1,
0xf8, 0x07, 0xff, 0xff, 0xf3, 0xe0, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
0x00, 0x1b, 0x00, 0x00, 0x00, 0x01, 0x9b, 0x00, 0x00, 0x00, 0x01, 0xce, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
void setup()
{
Serial.begin(9600);
Wire.begin();
Wire.beginTransmission(SCD30_I2C_ADDRESS);
scd30.setDebug(scd_debug);
scd30.begin(Wire);
scd30.setAutoSelfCalibration(1);
delay(1000);
display.begin(SSD1306_SWITCHCAPVCC, OLED_I2C_ADDRESS);
display.clearDisplay();
display.setTextColor(WHITE, BLACK);
display.setTextWrap(false);
delay(10);
Serial.println();
Serial.print("Connecting to network: ");
display.setCursor(8, 25);
display.setTextSize(2);
display.println("Connecting to network: ");
display.display(); delay(3000);
display.clearDisplay();
Serial.println(ssid);
WiFi.disconnect(true);
WiFi.mode(WIFI_STA); //init wifi mode
esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)EAP_ANONYMOUS_IDENTITY, strlen(EAP_ANONYMOUS_IDENTITY));
esp_wifi_sta_wpa2_ent_set_username((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY));
esp_wifi_sta_wpa2_ent_set_password((uint8_t *)EAP_PASSWORD, strlen(EAP_PASSWORD));
esp_wpa2_config_t config = WPA2_CONFIG_INIT_DEFAULT(); //set config settings to default
esp_wifi_sta_wpa2_ent_enable(&config); //set config settings to enable function
WiFi.begin(ssid);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
counter++;
if (counter >= 60) //after 30 seconds timeout - reset board
{
ESP.restart();
}
}
Serial.println("");
Serial.println("WiFi connected");
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
// WELCOME SCREEN
rssi = WiFi.RSSI();
networkStrength(rssi);
if (rssi < 0)
{
NTP();
display.setCursor(8, 25);
display.setTextSize(2);
display.println("Datalogger");
display.display(); delay(3000);
display.clearDisplay();
NTP();
networkStrength(rssi);
display.drawBitmap(10, 15, EPRESlogo, 50, 50, WHITE);
display.drawBitmap(65, 15, IITDLogo, 50, 50, WHITE);
display.display(); delay(3000);
display.clearDisplay();
}
else
{
display.setCursor(8, 25);
display.setTextSize(2);
display.println("Datalogger");
display.display(); delay(3000);
display.clearDisplay();
networkStrength(rssi);
display.drawBitmap(10, 15, EPRESlogo, 50, 50, WHITE);
display.drawBitmap(65, 15, IITDLogo, 50, 50, WHITE);
display.display(); delay(3000);
display.clearDisplay();
}
}
void loop()
{
temperature = 0;
humidity = 0;
co2 = 0;
if (scd30.dataAvailable())
{
temperature = scd30.getTemperature(); temp_str = String(temperature) + "C";
humidity = scd30.getHumidity(); hum_str = String(humidity) + "%";
co2 = scd30.getCO2(); co2_str = String(co2) + "ppm";
notif_wifi = "";
notif_sensor = "";
LCDdisplay(temp_str, hum_str, co2_str, notif_wifi, notif_sensor);
Serial.print("co2(ppm):"); Serial.print(scd30.getCO2());
Serial.print(" temp(C):"); Serial.print(scd30.getTemperature(), 1);
Serial.print(" humidity(%):"); Serial.print(scd30.getHumidity(), 1);
}
else
{
temp_str = "No Data";
hum_str = "No Data";
co2_str = "No Data";
notif_wifi = "";
notif_sensor = "Check Sensor";
LCDdisplay(temp_str, hum_str, co2_str, notif_wifi, notif_sensor);
Serial.println("No data");
}
// const size_t capacity = JSON_ARRAY_SIZE(2) + JSON_OBJECT_SIZE(3);
// DynamicJsonBuffer jsonBuffer(capacity);
// JsonObject& root1 = jsonBuffer.createObject();
// JsonObject& root2 = jsonBuffer.createObject();
//
// root1["Date"] = dateStamp_firebase;
// root1["Time"] = timeStamp_firebase;
// root1["Temperature"] = temperature;
// root1["Humidity"] = humidity;
// root1["CO2"] = co2;
//
// root2["Temperature"] = temperature;
// root2["Humidity"] = humidity;
// root2["CO2"] = co2;
//
// String path1 = "/SensorValues";
// String path2 = "/SensorValuesLog/" + dateStamp_firebase + "/" + timeStamp_firebase;
// Firebase.set(path1, root1);
// Firebase.set(path2, root2);
// root1.printTo(Serial); Serial.println(); root2.printTo(Serial); Serial.println();
}
void networkStrength(int rssiVal)
{
if (rssiVal >= 0)
{
display.fillRect(123, 8, 1, 4, BLACK);
display.fillRect(125, 5, 1, 7, BLACK);
display.fillRect(127, 1, 1, 11, BLACK);
}
else if (rssiVal >= -50 && rssiVal < 0)
{
display.fillRect(123, 8, 1, 4, WHITE);
display.fillRect(125, 5, 1, 7, WHITE);
display.fillRect(127, 1, 1, 11, WHITE);
}
else if (rssiVal < -50 && rssiVal > -75)
{
display.fillRect(123, 8, 1, 4, WHITE);
display.fillRect(125, 5, 1, 7, WHITE);
}
else
{
display.fillRect(123, 8, 1, 4, WHITE);
}
}
void NTP()
{
timeClient.begin();
while (!timeClient.update())
{
timeClient.forceUpdate();
}
String formattedDate = timeClient.getFormattedDate();
int splitT = formattedDate.indexOf("T");
String dateStamp_display_temp = formattedDate.substring(0, splitT);
String day = String(dateStamp_display_temp[8]) + String(dateStamp_display_temp[9]);
String month = String(dateStamp_display_temp[5]) + String(dateStamp_display_temp[6]);
String year = String(dateStamp_display_temp[0]) + String(dateStamp_display_temp[1]) + String(dateStamp_display_temp[2]) + String(dateStamp_display_temp[3]);
dateStamp_display = day + "/" + month;
dateStamp_firebase = day + "-" + month + "-" + year;
String timeStamp_display_temp = formattedDate.substring(splitT + 1, formattedDate.length() - 1);
String hour = String(timeStamp_display_temp[0]) + String(timeStamp_display_temp[1]);
String minute = String(timeStamp_display_temp[3]) + String(timeStamp_display_temp[4]);
String second = String(timeStamp_display_temp[6]) + String(timeStamp_display_temp[7]);
int h = hour.toInt();
if (h < 12)
{
String hour = String(h);
timeStamp_display = hour + ":" + minute + "am";
timeStamp_firebase = hour + "-" + minute + + "-" + second + "am";
}
else
{
if (h == 12)
{
h = 12;
}
else
{
h = h - 12;
}
String hour = String(h);
timeStamp_display = hour + ":" + minute + "pm";
timeStamp_firebase = hour + "-" + minute + + "-" + second + "pm";
}
display.setCursor(20, 0);
display.setTextSize(1);
display.print(dateStamp_display);
display.print(" ");
display.println(timeStamp_display);
}
void LCDdisplay(String t, String h, String c, String n_wifi, String n_sensor)
{
String n;
// ------------------Temperature Screen------------------
rssi = WiFi.RSSI();
networkStrength(rssi);
if (rssi >= 0)
{
n_wifi = "Check WiFi";
if (n_wifi.length() != 0 && n_sensor.length() != 0)
{
String n1 = "Check WiFi";
String n2 = "and Sensor";
display.clearDisplay();
display.setTextSize(2);
display.setCursor(3, 20); display.println(n1);
display.setCursor(3, 37); display.println(n2);
display.display();
delay(2000);
display.clearDisplay();
}
else
{
n = n_wifi;
display.drawBitmap(5, 20, temperatureLogo, 40, 40, WHITE);
display.setTextSize(2);
display.setCursor(50, 30); display.println(t);
display.setTextSize(1);
display.setCursor(53, 50); display.println(n);
display.display();
delay(2000);
display.clearDisplay();
}
}
else if (rssi < 0)
{
networkStrength(rssi);
if (n_sensor.length() != 0)
{
n = n_sensor;
NTP();
display.drawBitmap(3, 20, temperatureLogo, 40, 40, WHITE);
display.setTextSize(2);
display.setCursor(47, 30); display.println(t);
display.setTextSize(1);
display.setCursor(53, 50); display.println(n);
display.display();
delay(2000);
display.clearDisplay();
}
else
{
NTP();
display.drawBitmap(5, 20, temperatureLogo, 40, 40, WHITE);
display.setTextSize(2);
display.setCursor(50, 30); display.println(t);
display.display();
delay(2000);
display.clearDisplay();
}
}
// ------------------Humidity Screen------------------
rssi = WiFi.RSSI();
networkStrength(rssi);
if (rssi >= 0)
{
n_wifi = "Check WiFi";
if (n_wifi.length() != 0 && n_sensor.length() != 0)
{
String n1 = "Check WiFi";
String n2 = "and Sensor";
display.clearDisplay();
display.setTextSize(2);
display.setCursor(3, 20); display.println(n1);
display.setCursor(3, 37); display.println(n2);
display.display();
delay(2000);
display.clearDisplay();
}
else
{
n = n_wifi;
display.drawBitmap(5, 20, humidityLogo, 40, 40, WHITE);
display.setTextSize(2);
display.setCursor(50, 30); display.println(h);
display.setTextSize(1);
display.setCursor(53, 50); display.println(n);
display.display();
delay(2000);
display.clearDisplay();
}
}
else if (rssi < 0)
{
if (n_sensor.length() != 0)
{
n = n_sensor;
NTP();
display.drawBitmap(3, 20, humidityLogo, 40, 40, WHITE);
display.setTextSize(2);
display.setCursor(47, 30); display.println(h);
display.setTextSize(1);
display.setCursor(53, 50); display.println(n);
display.display();
delay(2000);
display.clearDisplay();
}
else
{
NTP();
display.drawBitmap(5, 20, humidityLogo, 40, 40, WHITE);
display.setTextSize(2);
display.setCursor(50, 30); display.println(h);
display.display();
delay(2000);
display.clearDisplay();
}
}
// ------------------CO2 Screen------------------
rssi = WiFi.RSSI();
networkStrength(rssi);
if (rssi >= 0)
{
n_wifi = "Check WiFi";
if (n_wifi.length() != 0 && n_sensor.length() != 0)
{
String n1 = "Check WiFi";
String n2 = "and Sensor";
display.clearDisplay();
display.setTextSize(2);
display.setCursor(3, 20); display.println(n1);
display.setCursor(3, 37); display.println(n2);
display.display();
delay(2000);
display.clearDisplay();
}
else
{
n = n_wifi;
display.drawBitmap(3, 20, co2Logo, 40, 40, WHITE);
display.setTextSize(2);
display.setCursor(47, 30); display.println(c);
display.setTextSize(1);
display.setCursor(53, 50); display.println(n);
display.display();
delay(2000);
display.clearDisplay();
}
}
else if (rssi < 0)
{
if (n_sensor.length() != 0)
{
n = n_sensor;
NTP();
display.drawBitmap(3, 20, co2Logo, 40, 40, WHITE);
display.setTextSize(2);
display.setCursor(47, 30); display.println(c);
display.setTextSize(1);
display.setCursor(53, 50); display.println(n);
display.display();
delay(2000);
display.clearDisplay();
}
else
{
NTP();
display.drawBitmap(3, 20, co2Logo, 40, 40, WHITE);
display.setTextSize(2);
display.setCursor(47, 30); display.println(c);
display.display();
delay(2000);
display.clearDisplay();
}
}
}
Can you help me with this?
It would have been handy to include some of the error messages to get a direction on your issue. I think you get messages that some variables/routines are double defined. If that is the case I suspect the reason is that in the file Adafruit_SSD1306.h, around line 41 it includes Wire.h.
Change in Adafruit_SSD1306.h the line from: #include <Wire.h> to something like : #include <scd30/SoftWire/SoftWire.h>
regards,
Paul
These are the errors:
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::available()':
C:\Users\Prateek\OneDrive\Documents\Arduino\libraries\scd30-master\src\SoftWire/SoftWire.cpp:172: multiple definition of `TwoWire::available()'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\Wire\src/Wire.cpp:239: first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::read()':
SoftWire.cpp:(.text._ZN7TwoWire4readEv+0x0): multiple definition of `TwoWire::read()'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire4readEv+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::peek()':
SoftWire.cpp:(.text._ZN7TwoWire4peekEv+0x0): multiple definition of `TwoWire::peek()'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire4peekEv+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::flush()':
SoftWire.cpp:(.text._ZN7TwoWire5flushEv+0x0): multiple definition of `TwoWire::flush()'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire5flushEv+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::write(unsigned char)':
SoftWire.cpp:(.text._ZN7TwoWire5writeEh+0x0): multiple definition of `TwoWire::write(unsigned char)'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire5writeEh+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::write(unsigned char const*, unsigned int)':
SoftWire.cpp:(.text._ZN7TwoWire5writeEPKhj+0x0): multiple definition of `TwoWire::write(unsigned char const*, unsigned int)'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire5writeEPKhj+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::setClock(unsigned int)':
SoftWire.cpp:(.text._ZN7TwoWire8setClockEj+0x0): multiple definition of `TwoWire::setClock(unsigned int)'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire8setClockEj+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::requestFrom(unsigned char, unsigned char, unsigned char)':
SoftWire.cpp:(.text._ZN7TwoWire11requestFromEhhh+0x0): multiple definition of `TwoWire::requestFrom(unsigned char, unsigned char, unsigned char)'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire11requestFromEhhh+0x0): first defined here
Multiple libraries were found for "WiFiClientSecure.h"
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::requestFrom(unsigned char, unsigned char)':
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\WiFiClientSecure
Multiple libraries were found for "SPI.h"
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\SPI
SoftWire.cpp:(.text._ZN7TwoWire11requestFromEhh+0x0): multiple definition of `TwoWire::requestFrom(unsigned char, unsigned char)'
Multiple libraries were found for "NTPClient.h"
Used: C:\Users\Prateek\OneDrive\Documents\Arduino\libraries\NTPClient-master
Multiple libraries were found for "Adafruit_GFX.h"
Used: C:\Users\Prateek\OneDrive\Documents\Arduino\libraries\Adafruit_GFX_Library
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire11requestFromEhh+0x0): first defined here
Not used: C:\Users\Prateek\OneDrive\Documents\Arduino\libraries\Adafruit-GFX-Library-master
Multiple libraries were found for "WiFi.h"
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\WiFi
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::requestFrom(int, int)':
Not used: C:\Program
SoftWire.cpp:(.text._ZN7TwoWire11requestFromEii+0x0): multiple definition of `TwoWire::requestFrom(int, int)'
Multiple libraries were found for "FS.h"
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\FS
Multiple libraries were found for "SPIFFS.h"
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\SPIFFS
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire11requestFromEii+0x0): first defined here
Multiple libraries were found for "HTTPClient.h"
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\HTTPClient
Multiple libraries were found for "SD.h"
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::requestFrom(int, int, int)':
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\SD
Not used: C:\Program
SoftWire.cpp:(.text._ZN7TwoWire11requestFromEiii+0x0): multiple definition of `TwoWire::requestFrom(int, int, int)'
Multiple libraries were found for "paulvha_SCD30.h"
Used: C:\Users\Prateek\OneDrive\Documents\Arduino\libraries\scd30-master
Multiple libraries were found for "Adafruit_SSD1306.h"
Used: C:\Users\Prateek\OneDrive\Documents\Arduino\libraries\Adafruit_SSD1306
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire11requestFromEiii+0x0): first defined here
Multiple libraries were found for "Wire.h"
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\Wire
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::beginTransmission(unsigned char)':
Multiple libraries were found for "FirebaseESP32.h"
Used: C:\Users\Prateek\OneDrive\Documents\Arduino\libraries\Firebase-ESP32-master
SoftWire.cpp:(.text._ZN7TwoWire17beginTransmissionEh+0x0): multiple definition of `TwoWire::beginTransmission(unsigned char)'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire17beginTransmissionEh+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::beginTransmission(int)':
SoftWire.cpp:(.text._ZN7TwoWire17beginTransmissionEi+0x0): multiple definition of `TwoWire::beginTransmission(int)'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire17beginTransmissionEi+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::endTransmission()':
SoftWire.cpp:(.text._ZN7TwoWire15endTransmissionEv+0x0): multiple definition of `TwoWire::endTransmission()'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire15endTransmissionEv+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o:(.bss.Wire+0x0): multiple definition of `Wire'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:(.bss.Wire+0x0): first defined here
c:/users/prateek/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-80-g6c4433a-5.2.0/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: Warning: size of symbol `Wire' changed from 304 in C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o to 16 in C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o
collect2.exe: error: ld returned 1 exit status
Thanks as I thought, it finds double definitions in both Wire and SoftWire. Make the change as I proposed. (I can't check as I do not have all your hardware and libraries installed)
regards
Paul
I put the SoftWire folder from your library in Adafruit_SSD1306 library folder and added the line #include <SoftWire/SoftWire.h>
Still the same error:
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::available()':
C:\Users\Prateek\OneDrive\Documents\Arduino\libraries\scd30-master\src\SoftWire/SoftWire.cpp:172: multiple definition of `TwoWire::available()'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\Wire\src/Wire.cpp:239: first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::read()':
SoftWire.cpp:(.text._ZN7TwoWire4readEv+0x0): multiple definition of `TwoWire::read()'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire4readEv+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::peek()':
SoftWire.cpp:(.text._ZN7TwoWire4peekEv+0x0): multiple definition of `TwoWire::peek()'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire4peekEv+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::flush()':
SoftWire.cpp:(.text._ZN7TwoWire5flushEv+0x0): multiple definition of `TwoWire::flush()'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire5flushEv+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::write(unsigned char)':
SoftWire.cpp:(.text._ZN7TwoWire5writeEh+0x0): multiple definition of `TwoWire::write(unsigned char)'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire5writeEh+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::write(unsigned char const*, unsigned int)':
SoftWire.cpp:(.text._ZN7TwoWire5writeEPKhj+0x0): multiple definition of `TwoWire::write(unsigned char const*, unsigned int)'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire5writeEPKhj+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::setClock(unsigned int)':
SoftWire.cpp:(.text._ZN7TwoWire8setClockEj+0x0): multiple definition of `TwoWire::setClock(unsigned int)'
Multiple libraries were found for "NTPClient.h"
Used: C:\Users\Prateek\OneDrive\Documents\Arduino\libraries\NTPClient-master
Multiple libraries were found for "SPI.h"
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\SPI
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire8setClockEj+0x0): first defined here
Multiple libraries were found for "WiFi.h"
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\WiFi
Not used: C:\Program
Multiple libraries were found for "FirebaseESP32.h"
Used: C:\Users\Prateek\OneDrive\Documents\Arduino\libraries\Firebase-ESP32-master
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::requestFrom(unsigned char, unsigned char, unsigned char)':
Multiple libraries were found for "FS.h"
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\FS
Multiple libraries were found for "SPIFFS.h"
SoftWire.cpp:(.text._ZN7TwoWire11requestFromEhhh+0x0): multiple definition of `TwoWire::requestFrom(unsigned char, unsigned char, unsigned char)'
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\SPIFFS
Multiple libraries were found for "HTTPClient.h"
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\HTTPClient
Multiple libraries were found for "WiFiClientSecure.h"
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\WiFiClientSecure
Multiple libraries were found for "SD.h"
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire11requestFromEhhh+0x0): first defined here
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\SD
Not used: C:\Program
Multiple libraries were found for "Wire.h"
Used: C:\Users\Prateek\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3\libraries\Wire
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::requestFrom(unsigned char, unsigned char)':
Multiple libraries were found for "Adafruit_GFX.h"
Used: C:\Users\Prateek\OneDrive\Documents\Arduino\libraries\Adafruit_GFX_Library
Not used: C:\Users\Prateek\OneDrive\Documents\Arduino\libraries\Adafruit-GFX-Library-master
SoftWire.cpp:(.text._ZN7TwoWire11requestFromEhh+0x0): multiple definition of `TwoWire::requestFrom(unsigned char, unsigned char)'
Multiple libraries were found for "Adafruit_SSD1306.h"
Used: C:\Users\Prateek\OneDrive\Documents\Arduino\libraries\Adafruit_SSD1306
Multiple libraries were found for "paulvha_SCD30.h"
Used: C:\Users\Prateek\OneDrive\Documents\Arduino\libraries\scd30-master
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire11requestFromEhh+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::requestFrom(int, int)':
SoftWire.cpp:(.text._ZN7TwoWire11requestFromEii+0x0): multiple definition of `TwoWire::requestFrom(int, int)'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire11requestFromEii+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::requestFrom(int, int, int)':
SoftWire.cpp:(.text._ZN7TwoWire11requestFromEiii+0x0): multiple definition of `TwoWire::requestFrom(int, int, int)'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire11requestFromEiii+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::beginTransmission(unsigned char)':
SoftWire.cpp:(.text._ZN7TwoWire17beginTransmissionEh+0x0): multiple definition of `TwoWire::beginTransmission(unsigned char)'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire17beginTransmissionEh+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::beginTransmission(int)':
SoftWire.cpp:(.text._ZN7TwoWire17beginTransmissionEi+0x0): multiple definition of `TwoWire::beginTransmission(int)'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire17beginTransmissionEi+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o: In function `TwoWire::endTransmission()':
SoftWire.cpp:(.text._ZN7TwoWire15endTransmissionEv+0x0): multiple definition of `TwoWire::endTransmission()'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:Wire.cpp:(.text._ZN7TwoWire15endTransmissionEv+0x0): first defined here
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o:(.bss.Wire+0x0): multiple definition of `Wire'
C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o:(.bss.Wire+0x0): first defined here
c:/users/prateek/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-80-g6c4433a-5.2.0/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: Warning: size of symbol `Wire' changed from 304 in C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\Wire\Wire.cpp.o to 16 in C:\Users\Prateek\AppData\Local\Temp\ArduinoServer\MW\libraries\scd30-master\SoftWire\SoftWire.cpp.o
collect2.exe: error: ld returned 1 exit status
By any chance do you have any code snippet for integrating scd sensor with some other i2c device like bme sensor, oled etc?
That will work for me, I'll make the required changes.
The issue is still the same.. somewhere Wire.h is still included.. I see that in Adafruit_GrayOLED.h. You need to make the same change (around line 33). THis is part of the Arduino-GFX library.
@paulvha I commented out the wire.h library from my code, and it worked. Is it a fine solution?
I have now re-read your post. As you commented out wire.h somewhere in your code that is the solution.!