Hello. I am new to Cayenne. Forgive me for my ignorance, I know this is probably the usual route into the Cayenne world. I am having trouble connecting with a Arduino Uno, staked with a breakout ESP8266 Wifi Shield. I have followed the step by step instruction but got an error - about “Serial1” was not declared in this scope"
I removed the “1” at the end, and the code compiled without an error.
I then uploaded it to my Arduino and I got an error (after a delayed uploading) - “Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.”
After several unsucessful attempts at resolving the issue, I disconnected the Arduino, removed the ESP8266 Wifi Shield and reconnected the Arduino to the computer via the USB. and I was then able to upload the sketch without an error. I then reattached the Wifi Shield and pressed the reset button…
but no cheese! Nothing is happening on the Cayenne Dashboard too.
I am running Windows 10 64Bit, IDE 1.6.7, Have installed CayenneMQTT Library, ESP8266MQTT, ESPSerialLibarary. my code is as below…
#include <ESP8266SerialLibrary.h>
//#define CAYENNE_DEBUG // Uncomment to show debug messages
//#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneMQTTESP8266Shield.h>
// WiFi network info.
char ssid[] = "SSID";
char wifiPassword[] = "123456";
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "<code from dash board>";
char password[] = "<code from dash board>";
char clientID[] = "<code from dash board>";
// Set ESP8266 Serial object. In this example we use the Serial1 hardware serial which is available on boards like the Arduino Mega.
#define EspSerial Serial
ESP8266 wifi(&EspSerial);
void setup()
{
Serial.begin(9600);
delay(10);
// Set ESP8266 baud rate
EspSerial.begin(115200);
delay(10);
Cayenne.begin(username, password, clientID, wifi, ssid, wifiPassword);
}
void loop()
{
Cayenne.loop();
}
// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
CAYENNE_OUT_DEFAULT()
{
// Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
Cayenne.virtualWrite(0, millis());
// Some examples of other functions you can use to send data.
//Cayenne.celsiusWrite(1, 22.0);
//Cayenne.luxWrite(2, 700);
//Cayenne.virtualWrite(3, 50, TYPE_PROXIMITY, UNIT_CENTIMETER);
}
// Default function for processing actuator commands from the Cayenne Dashboard.
// You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
CAYENNE_LOG("Channel %u, value %s", request.channel, getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError("Error message");
}
What could I be doing wrong?