Hi friends,
Im using a wifishield ESP8266 with an arduino uno and a web dashboard.
I installed Cayenne library in my arduino IDE ,but I have a problem in compiling WifiShiled sketch.
you can see the picture below. Thank you
I canât see much of your code there but from the error it looks like you are trying to use CayenneWiFi.h which wonât work with the ESP8266 devices. Try this for your includes:
#include "CayenneDefines.h"
#include "BlynkSimpleEsp8266.h"
#include "CayenneWiFiClient.h"
i try it, but itâs the same.the errors shown in the picture are :
In file included from C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/BlynkSimpleWiFi.h:23,
from C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/CayenneWiFi.h:27,
from WiFiShield.ino:22:
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/Adapters/BlynkWiFiCommon.h: In member function âvoid BlynkWifiCommon::connectWiFi(const char*, const char*)â:
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/Adapters/BlynkWiFiCommon.h:33: error: âWL_IDLE_STATUSâ was not declared in this scope
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/Adapters/BlynkWiFiCommon.h:35: error: âWiFiâ was not declared in this scope
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/Adapters/BlynkWiFiCommon.h:35: error: âWL_NO_SHIELDâ was not declared in this scope
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/Adapters/BlynkWiFiCommon.h:43: error: âWiFiâ was not declared in this scope
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/Adapters/BlynkWiFiCommon.h:45: error: âWiFiâ was not declared in this scope
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/Adapters/BlynkWiFiCommon.h:47: error: âWL_CONNECTEDâ was not declared in this scope
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/Adapters/BlynkWiFiCommon.h:54: error: âWiFiâ was not declared in this scope
In file included from C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/CayenneWiFi.h:27,
from WiFiShield.ino:22:
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/BlynkSimpleWiFi.h: At global scope:
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/BlynkSimpleWiFi.h:26: error: âWiFiClientâ does not name a type
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/BlynkSimpleWiFi.h:27: error: â_blynkWifiClientâ was not declared in this scope
Can you post your code? Also, are you using the .cc Arduno IDE or .org IDE?
i use .cc . the code is (i used the sketch of wifishield in cayenne library) :
//#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneWiFi.h>
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "AuthenticationToken";
// Your network name and password.
char ssid[] = "NetworkSSID";
char password[] = "NetworkPassword";
void setup()
{
Serial.begin(9600);
Cayenne.begin(token, ssid, password);
}
void loop()
{
Cayenne.run();
}
Try this:
//#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include "CayenneDefines.h"
#include "BlynkSimpleEsp8266.h"
#include "CayenneWiFiClient.h"
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "AuthenticationToken";
// Your network name and password.
char ssid[] = "NetworkSSID";
char password[] = "NetworkPassword";
void setup()
{
Serial.begin(9600);
Cayenne.begin(token, ssid, password);
}
void loop()
{
Cayenne.run();
}
it shows this errors:
In file included from arduino_IOT.ino:47:
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/BlynkSimpleEsp8266.h:15:2: error: #error This code is intended to run on the ESP8266 platform! Please check your Tools->Board setting.
In file included from arduino_IOT.ino:47:
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/BlynkSimpleEsp8266.h: In member function âvoid BlynkWifi::connectWiFi(const char*, const char*)â:
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/BlynkSimpleEsp8266.h:39: error: âWiFiâ was not declared in this scope
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/BlynkSimpleEsp8266.h:39: error: âWIFI_STAâ was not declared in this scope
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/BlynkSimpleEsp8266.h:45: error: âWL_CONNECTEDâ was not declared in this scope
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/BlynkSimpleEsp8266.h: At global scope:
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/BlynkSimpleEsp8266.h:92: error: âWiFiClientâ does not name a type
C:\Users\dhafer\Documents\Arduino\libraries\Cayenne/BlynkSimpleEsp8266.h:93: error: â_blynkWifiClientâ was not declared in this scope
If you click the Tools menu, next to Board, is there an ESP device listed there? If not hover over Board and select whichever variant you are using.
I DONT find it. But the problem appear when i made the compilation(when i cliked in the buton colored in yellow in the picture below) , not when i downloded the code in the board.
Do you have the ESP boards installed?
Installing with Boards Manager
Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32 and 64 bit).
Install Arduino 1.6.8 from the Arduino website.
Start Arduino and open Preferences window.
Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
Open Boards Manager from Tools > Board menu and install esp8266 platform (and donât forget to select your ESP8266 board from Tools > Board menu after installation).
If you are using the ESP8266 as a Wifi shield with the AT command set installed on the ESP, and the Uno as the host, then this will not work.
@adam is talking about overwriting the flash in the ESP module itself so you donât even need an Uno.
Connect your Uno serial port RX to TX and TX to RX on the ESP. Note that the ESP pins are 5V tolerant, but if you want to be nice, put a 1K resistor inline between the Uno TX and the ESP RX. Also note that the ESP supply must be 3.3V. If you put 5V there, it will get hot.
You need this code if using the ESP as a shield (unreleased code):
/*
Cayenne ESP8266 Shield WiFi Example
Adapted from Blynk's ESP8266_Shield_HardSer Example
This sketch connects to the Cayenne server using an ESP8266 WiFi module as a shield connected
via a hardware serial to an Arduino.
You should install the ESP8266HardwareSerial.zip library via the Arduino IDE (Sketch->Include Library->Add .ZIP Library)
from the Cayenne extras/libraries folder (e.g. My Documents\Arduino\libraries\Cayenne\extras\libraries) to compile this example.
NOTE: Ensure a stable serial connection to ESP8266!
Firmware version 1.0.0 (AT v0.22) or later is needed.
You can change ESP baud rate. Connect to AT console and call:
AT+UART_DEF=115200,8,1,0,0
For Cayenne Dashboard widgets using digital or analog pins this sketch will automatically
send data on those pins to the Cayenne server. If the widgets use Virtual Channels, data
should be sent to those channels using virtualWrites. Examples for sending and receiving
Virtual Channel data are under the Basics folder.
*/
//#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneESP8266Shield.h>
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "AuthenticationToken";
// Your network name and password.
char ssid[] = "NetworkSSID";
char password[] = "NetworkPassword";
// Set ESP8266 Serial object
#define EspSerial Serial1
ESP8266 wifi(EspSerial);
void setup()
{
Serial.begin(9600);
delay(10);
// Set ESP8266 baud rate
EspSerial.begin(115200);
delay(10);
Cayenne.begin(token, wifi, ssid, password);
}
void loop()
{
Cayenne.run();
}
This code relies on your Arduino device having a second serial port. You will need to install the attached CayenneESP8266Shield.log to your Cayenne library directory and rename it with a .h extension. Also, donât forget to install the ESP8266HardwareSerial library (rename attached as .zip)
I am working on kludging a way to use the SoftwareSerial library as well, but havenât got around to it yet.
CayenneESP8266Shield.log (1.8 KB)
ESP8266HardwareSerial.log (11.3 KB)
Cheers,
Craig
lol not sure how I missed that. Selective reading I guessâŚ
Iâm just here to keep an eye on you, Adam
Cheers,
Kreggly returns to designing his IoT flamethrower.
Hello Kreggly
I am new to Cayenne community was trying to connect Cayenne server using an ESP8266 WiFi module as a shield connected via a hardware serial to an Arduino.
I found above information helpful, as per your suggestion tried to compile above code in Arduino IDE, but getting below error .
C:\Users\hp\Documents\Arduino\sketch_dec10a\sketch_dec10a.ino:24:34: fatal error: CayenneESP8266Shield.h: No such file or directory compilation terminated.
I donât have âESP8266HardwareSerial.zipâ library in my Cayenne extras/libraries folder (e.g. My Documents\Arduino\libraries\Cayenne\extras\libraries)
Requesting you please share this zip file .
Best Regards
Prashant
I have pro with this, can you help me ???
Cayenne/BlynkSimpleShieldEsp8266_HardSer.h:27:29: fatal error: ESP8266_HardSer.h: No such file or directory
** #include ESP8266_HardSer.h**
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.
@ehkrap and @ngovan.thanh,
You need to look up and copy the CayenneESP8266Shield.log file into the Cayenne directory and rename it with the .h extension. Then take ESP8266HardwareSerial.log and rename it with the .zip extension and install it via the Arduino IDE (Sketch->Include Library->Add .ZIP Library)
There is no official release of the ESP shield code for Cayenne yet, so we have to do it this way.
Cheers,
Craig
Thanks you so much, Iâll try to do it
I tried this, but received errors opening the library .zip:
Arduino: 1.6.13 (Windows 7), Board: âESPDuino (ESP-13 Module), 80 MHz, 115200, 4M (3M SPIFFS)â
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:219)
at java.util.zip.ZipFile.(ZipFile.java:149)
at java.util.zip.ZipFile.(ZipFile.java:163)
at processing.app.tools.ZipDeflater.(ZipDeflater.java:26)
at processing.app.Base.handleAddLibrary(Base.java:2206)
at processing.app.Base$6.actionPerformed(Base.java:1032)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
This report would have more information with
âShow verbose output during compilationâ
option enabled in File â Preferences.
Looks like you have a privilege issue on your PC. Try running the Arduino IDE as administrator.
You can also unzip the library and copy the folder into the libraries directory, then restart the IDE.
Cheers,
Craig
My bad - forgot I was using Windows (I needed Win7 for something else) and saved the file incorrectly instead of renaming it.
Sorry, I am new to this and should probably go back to easier stuff until I get my head around it - I get this now:
Arduino: 1.6.13 (Windows 7), Board: âESPDuino (ESP-13 Module), 80 MHz, 115200, 4M (3M SPIFFS)â
C:\Users\tbscully\Documents\Arduino\libraries\Cayenne\ESP8266.cpp:22:26: fatal error: avr/pgmspace.h: No such file or directory
#include <avr/pgmspace.h>
^
compilation terminated.
exit status 1
Error compiling for board ESPDuino (ESP-13 Module).
This report would have more information with
âShow verbose output during compilationâ
option enabled in File â Preferences.