You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am watching @t04glovern udemy course and trying to make environment sensor, I have used following code but getting error, kindly help me out.
`
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
#include "main.h"
#include <AWS_IOT.h>
// for sensors
dht.begin();
if (!bme.begin()) {
Serial.println("Could not find a valid BMP280 sensor, check wiring!");
while (1);
}
if (! sgp.begin()) {
Serial.println("Sensor not found :(");
while (1);
}
if (aws_iot.connect(aws_mqtt_server, aws_mqtt_client_id) == 0)
{
Serial.println("connected to aws");
delay(500);
}
else {
Serial.println("connection failed with aws");
while (1);
}
}
void loop() {
// put your main code here, to run repeatedly:
readSensor();
sendDataToServer();
}
and i am getting following error
`
In file included from C:\Users\rb23\Documents\Arduino\libraries\AWS_IOT\src\network_interface.h:35:0,
-> candidates: []
Multiple libraries were found for "ESP8266WebServer.h"
from C:\Users\rb23\Documents\Arduino\libraries\AWS_IOT\src\aws_iot_mqtt_client.h:57,
Used: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\ESP8266WebServer
Multiple libraries were found for "WiFiManager.h"
from C:\Users\rb23\Documents\Arduino\libraries\AWS_IOT\src\AWS_IOT.cpp:39:
Used: C:\Users\rb23\Documents\Arduino\libraries\WiFiManager
C:\Users\rb23\Documents\Arduino\libraries\AWS_IOT\src\network_platform.h:20:28: fatal error: mbedtls/config.h: No such file or directory
Not used: C:\Users\rb23\Documents\Arduino\libraries\WhareHauoraWiFiManager
#include "mbedtls/config.h"
Multiple libraries were found for "PubSubClient.h"
^
Not used: C:\Users\rb23\Documents\Arduino\libraries\pubsubclient-master
Multiple libraries were found for "Wire.h"
Used: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\Wire
Multiple libraries were found for "Adafruit_SGP30.h"
Used: C:\Users\rb23\Documents\Arduino\libraries\Adafruit_SGP30_Sensor
Multiple libraries were found for "Adafruit_BMP280.h"
Used: C:\Users\rb23\Documents\Arduino\libraries\Adafruit_BMP280_Library
Multiple libraries were found for "SPI.h"
Used: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\SPI
Multiple libraries were found for "ESP8266WiFi.h"
Used: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\ESP8266WiFi
Multiple libraries were found for "AWS_IOT.h"
Used: C:\Users\rb23\Documents\Arduino\libraries\AWS_IOT
Multiple libraries were found for "DNSServer.h"
Used: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\DNSServer
Multiple libraries were found for "ArduinoJson.h"
Used: C:\Users\rb23\Documents\Arduino\libraries\ArduinoJson
Multiple libraries were found for "Adafruit_Sensor.h"
Used: C:\Users\rb23\Documents\Arduino\libraries\Adafruit_Sensor-master
Not used: C:\Users\rb23\Documents\Arduino\libraries\Adafruit_Unified_Sensor
Multiple libraries were found for "DHT.h"
Used: C:\Users\rb23\Documents\Arduino\libraries\DHT_sensor_library
Using library ESP8266WiFi at version 1.0 in folder: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\ESP8266WiFi
Using library AWS_IOT at version 1.0 in folder: C:\Users\rb23\Documents\Arduino\libraries\AWS_IOT
Using library DNSServer at version 1.1.1 in folder: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\DNSServer
Using library ESP8266WebServer at version 1.0 in folder: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\ESP8266WebServer
Using library WiFiManager at version 0.15.0-beta in folder: C:\Users\rb23\Documents\Arduino\libraries\WiFiManager
Using library PubSubClient at version 2.6 in folder: C:\Users\rb23\Documents\Arduino\libraries\PubSubClient
Using library ArduinoJson at version 6.13.0 in folder: C:\Users\rb23\Documents\Arduino\libraries\ArduinoJson
Using library Wire at version 1.0 in folder: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\Wire
Using library Adafruit_SGP30_Sensor at version 1.0.5 in folder: C:\Users\rb23\Documents\Arduino\libraries\Adafruit_SGP30_Sensor
Using library Adafruit_Sensor-master at version 1.0.3 in folder: C:\Users\rb23\Documents\Arduino\libraries\Adafruit_Sensor-master
Using library Adafruit_BMP280_Library at version 1.0.5 in folder: C:\Users\rb23\Documents\Arduino\libraries\Adafruit_BMP280_Library
Using library SPI at version 1.0 in folder: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\SPI
Using library DHT_sensor_library at version 1.3.8 in folder: C:\Users\rb23\Documents\Arduino\libraries\DHT_sensor_library
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
`
The text was updated successfully, but these errors were encountered:
I am watching @t04glovern udemy course and trying to make environment sensor, I have used following code but getting error, kindly help me out.
`
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
#include "main.h"
#include <AWS_IOT.h>
//needed for library
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
#include <PubSubClient.h>
#include <ArduinoJson.h> //https://github.com/bblanchon/ArduinoJson (use v6.xx)
#include <time.h>
//for getting all the sensor data
#include <Wire.h>
#include "Adafruit_SGP30.h"
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#include "DHT.h"
//dht pin type and initialization
#define DHTTYPE DHT11 // DHT 11
#define dht_dpin D4
DHT dht(dht_dpin, DHTTYPE);
//initialization of bme and sgp
Adafruit_BMP280 bme; // I2C
Adafruit_SGP30 sgp;
//variables for sensors
float temperature;
float humidity;
float tvoc;
float eco2;
float p = 0.0;
float h2 = 0.0;
float eth = 0.0;
AWS_IOT aws_iot;
void readSensor()
{
if (! sgp.IAQmeasure()) {
Serial.println("Measurement failed");
return;
}
temperature = bme.readTemperature();
humidity = dht.readHumidity();
tvoc = sgp.TVOC;
eco2 = sgp.eCO2;
}
void NTPConnect(void)
{
Serial.print("Setting time using SNTP");
configTime(19800, DST * 3600, "pool.ntp.org", "time.nist.gov");
now = time(nullptr);
while (now < nowish)
{
delay(500);
Serial.print(".");
now = time(nullptr);
}
Serial.println("done!");
struct tm timeinfo;
gmtime_r(&now, &timeinfo);
Serial.print("Current time: ");
Serial.println(asctime(&timeinfo));
// String tm1 = String(1900+timeinfo.tm_year)+":"+String(timeinfo.tm_mon+1)+":"+String(timeinfo.tm_mday)
// + ","+String(timeinfo.tm_hour)+":"+String(timeinfo.tm_min)+":"+String(timeinfo.tm_sec);
// Serial.println("Current time: ");
// Serial.println(tm1);
// Serial.print(timeinfo.tm_sec);
// Serial.print(timeinfo.tm_min);
}
void messageReceived(char *topic, byte *payload, unsigned int length)
{
Serial.print("Received [");
Serial.print(topic);
Serial.print("]: ");
for (int i = 0; i < length; i++)
{
Serial.print((char)payload[i]);
}
Serial.println();
}
void sendDataToServer()
{
struct tm timeinfo;
gmtime_r(&now, &timeinfo);
Serial.print("Current time: ");
Serial.print(asctime(&timeinfo));
//String tm1 = String(asctime(&timeinfo));
String tm1 = String(1900 + timeinfo.tm_year) + ":" + String(timeinfo.tm_mon + 1) + ":" + String(timeinfo.tm_mday)
+ "," + String(timeinfo.tm_hour) + ":" + String(timeinfo.tm_min) + ":" + String(timeinfo.tm_sec);
DynamicJsonDocument jsonBuffer(JSON_OBJECT_SIZE(1) + 200);
JsonObject root = jsonBuffer.to();
// JsonObject state = root.createNestedObject("state");
// JsonObject state_reported = state.createNestedObject("reported");
// state_reported["value"] = random(100);/
root["sensorValue"] = String(temperature);
root["time_stamp"] = String(tm1);
root["humadity_sensor"] = String(humidity);
root["pressure_sensor"] = String(p);
root["ECO2"] = String(eco2);
root["H2"] = String(h2);
root["TVOC"] = String(tvoc);
root["ETH"] = String(eth);
Serial.printf("Sending1 [%s]: ", aws_mqtt_thing_topic_pub);
serializeJson(root, Serial);
Serial.println();
char shadow[measureJson(root) + 1];
serializeJson(root, shadow, sizeof(shadow));
if (client.publish(aws_mqtt_thing_topic_pub, shadow, false))
{
Serial.println("data sent to aws");
Serial.println(shadow);
}
else
Serial.println("data not sent");
}
void setup() {
Serial.begin(115200);
WiFiManager wifiManager;
wifiManager.autoConnect("power8");
Serial.println("connected...with wifi :)");
// for sensors
dht.begin();
if (!bme.begin()) {
Serial.println("Could not find a valid BMP280 sensor, check wiring!");
while (1);
}
if (! sgp.begin()) {
Serial.println("Sensor not found :(");
while (1);
}
if (aws_iot.connect(aws_mqtt_server, aws_mqtt_client_id) == 0)
{
Serial.println("connected to aws");
delay(500);
}
else {
Serial.println("connection failed with aws");
while (1);
}
}
void loop() {
// put your main code here, to run repeatedly:
readSensor();
sendDataToServer();
}
`
contents of main.h is
`
#ifndef MAIN_H
const String thing_id = "env_sensor";
// AWS MQTT Details
char *aws_mqtt_server = "a1eriwaw6byf4f-ats.iot.ap-south-1.amazonaws.com";
char *aws_mqtt_client_id = "env_sensor";
char *aws_mqtt_thing_topic_pub = "env_sensor";
#endif
int8_t TIME_ZONE = +5; //NYC(USA): -5 UTC
`
and i am getting following error
`
In file included from C:\Users\rb23\Documents\Arduino\libraries\AWS_IOT\src\network_interface.h:35:0,
-> candidates: []
Multiple libraries were found for "ESP8266WebServer.h"
from C:\Users\rb23\Documents\Arduino\libraries\AWS_IOT\src\aws_iot_mqtt_client.h:57,
Used: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\ESP8266WebServer
Multiple libraries were found for "WiFiManager.h"
from C:\Users\rb23\Documents\Arduino\libraries\AWS_IOT\src\AWS_IOT.cpp:39:
Used: C:\Users\rb23\Documents\Arduino\libraries\WiFiManager
C:\Users\rb23\Documents\Arduino\libraries\AWS_IOT\src\network_platform.h:20:28: fatal error: mbedtls/config.h: No such file or directory
Not used: C:\Users\rb23\Documents\Arduino\libraries\WhareHauoraWiFiManager
#include "mbedtls/config.h"
Multiple libraries were found for "PubSubClient.h"
^
Used: C:\Users\rb23\Documents\Arduino\libraries\PubSubClient
compilation terminated.
Not used: C:\Users\rb23\Documents\Arduino\libraries\pubsubclient-master
Multiple libraries were found for "Wire.h"
Used: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\Wire
Multiple libraries were found for "Adafruit_SGP30.h"
Used: C:\Users\rb23\Documents\Arduino\libraries\Adafruit_SGP30_Sensor
Multiple libraries were found for "Adafruit_BMP280.h"
Used: C:\Users\rb23\Documents\Arduino\libraries\Adafruit_BMP280_Library
Multiple libraries were found for "SPI.h"
Used: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\SPI
Multiple libraries were found for "ESP8266WiFi.h"
Used: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\ESP8266WiFi
Multiple libraries were found for "AWS_IOT.h"
Used: C:\Users\rb23\Documents\Arduino\libraries\AWS_IOT
Multiple libraries were found for "DNSServer.h"
Used: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\DNSServer
Multiple libraries were found for "ArduinoJson.h"
Used: C:\Users\rb23\Documents\Arduino\libraries\ArduinoJson
Multiple libraries were found for "Adafruit_Sensor.h"
Used: C:\Users\rb23\Documents\Arduino\libraries\Adafruit_Sensor-master
Not used: C:\Users\rb23\Documents\Arduino\libraries\Adafruit_Unified_Sensor
Multiple libraries were found for "DHT.h"
Used: C:\Users\rb23\Documents\Arduino\libraries\DHT_sensor_library
Using library ESP8266WiFi at version 1.0 in folder: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\ESP8266WiFi
Using library AWS_IOT at version 1.0 in folder: C:\Users\rb23\Documents\Arduino\libraries\AWS_IOT
Using library DNSServer at version 1.1.1 in folder: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\DNSServer
Using library ESP8266WebServer at version 1.0 in folder: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\ESP8266WebServer
Using library WiFiManager at version 0.15.0-beta in folder: C:\Users\rb23\Documents\Arduino\libraries\WiFiManager
Using library PubSubClient at version 2.6 in folder: C:\Users\rb23\Documents\Arduino\libraries\PubSubClient
Using library ArduinoJson at version 6.13.0 in folder: C:\Users\rb23\Documents\Arduino\libraries\ArduinoJson
Using library Wire at version 1.0 in folder: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\Wire
Using library Adafruit_SGP30_Sensor at version 1.0.5 in folder: C:\Users\rb23\Documents\Arduino\libraries\Adafruit_SGP30_Sensor
Using library Adafruit_Sensor-master at version 1.0.3 in folder: C:\Users\rb23\Documents\Arduino\libraries\Adafruit_Sensor-master
Using library Adafruit_BMP280_Library at version 1.0.5 in folder: C:\Users\rb23\Documents\Arduino\libraries\Adafruit_BMP280_Library
Using library SPI at version 1.0 in folder: C:\Users\rb23\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\libraries\SPI
Using library DHT_sensor_library at version 1.3.8 in folder: C:\Users\rb23\Documents\Arduino\libraries\DHT_sensor_library
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
`
The text was updated successfully, but these errors were encountered: