Wrote this sketch for those that want to use the BME280 sensor with the ESP8266.
Rick
#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <Wire.h>
#include <BME280.h>//sensor library Adafruit or other
#include "CayenneDefines.h"
#include "BlynkSimpleEsp8266.h"
#include "CayenneWiFiClient.h"
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = “TOKEN HERE”;
// Your network name and password.
char ssid[] = “SSID HERE“;
char password[] = “PASSWORD HERE”;
// Virtual Pins of the BME280 widget.
#define TEMPERATURE_PIN V0
#define BAROMETER_PIN V1
#define HUMIDITY_PIN V2
BME280 bme; //Create an instance of the sensor
void setup()
{
Serial.begin(9600);
Cayenne.begin(token, ssid, password);
bme.begin();
}
void loop()
{
Cayenne.run();
}
// These functions are called when the Cayenne widget requests data for the Virtual Pin.
CAYENNE_OUT(V0)
{
// Send the Temperature value to Cayenne
Cayenne.virtualWrite(V0, bme.ReadTemperature());
}
CAYENNE_OUT(V1)
{
// Send the Pressure value to Cayenne
Cayenne.virtualWrite(V1, bme.ReadPressure());
}
CAYENNE_OUT(V2)
{
// Send the Humidity value to Cayenne
Cayenne.virtualWrite(V2, bme.ReadHumidity());
}
I think that this error means that there is no definition for that identifier visible for the compiler.
Did you put your library in the right place → sketchbook /libraries path?
Seems some issues with unsupported characters and library calls in the above sketch. Try this one. I will try and compile it when I get home:
Also, make sure you are using the Adafruit libraries from here:
#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <Wire.h>
#include <BME280.h> //sensor library Adafruit or other
#include "CayenneDefines.h"
#include "BlynkSimpleEsp8266.h"
#include "CayenneWiFiClient.h"
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "TOKEN HERE";
// Your network name and password.
char ssid[] = "SSID HERE";
char password[] = "PASSWORD HERE";
// Virtual Pins of the BME280 widget.
#define TEMPERATURE_PIN V0
#define BAROMETER_PIN V1
#define HUMIDITY_PIN V2
BME280 bme; //Create an instance of the sensor
void setup()
{
Serial.begin(9600);
Cayenne.begin(token, ssid, password);
bme.begin();
}
void loop()
{
Cayenne.run();
}
// These functions are called when the Cayenne widget requests data for the Virtual Pin.
CAYENNE_OUT(V0)
{
// Send the Temperature value to Cayenne
Cayenne.virtualWrite(V0, bme.readTemperature());
}
CAYENNE_OUT(V1)
{
// Send the Pressure value to Cayenne
Cayenne.virtualWrite(V1, bme.readPressure());
}
CAYENNE_OUT(V2)
{
// Send the Humidity value to Cayenne
Cayenne.virtualWrite(V2, bme.readHumidity());
}
This is my first post.
I use ArduinoMega and Ethernet Shiels W5100.
After added 2 LEds in dashboard now I want to integrate my BME280 sensor in Cayenne dashboard.
Can you tell me wich are the steps?
Thank you for patience.
Later edit:
From Dashboard:
Add new - Device widget - Custom widget - Value - Pin virtual - Pin number - Data - Unit - Icon.
Copy Cayenne code, make new INO file and paste code, add data from BME280 sensor.
Must add 3 different widges for each BME280 parameters (temperature, pressure and humidity).
I’ll make 1 files with 3 parameters and flash to Arduino.
It’s OK?