WifiShield with arduino uno compiling error


#1

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


#2

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"

#3

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


#4

Can you post your code? Also, are you using the .cc Arduno IDE or .org IDE?


#5

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();
}

#6

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();
}

#7

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


#8

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.


#9

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.


#10

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).


Cayenne support WiFiEsp https://github.com/bportaluri/WiFiEsp
Problem in connecting with cayenne dashboard i have check the telnet port its ok, and also by esp8266 get connected to network ssid through AT commands not by the program
Same project, new device
#11

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


How to set up Uno + esp8266 seperate module?
Esp8266-01 as wifi shield
Esp8266
Wifi shield not working
ESP13 Shield from Doit.am Supported?
Wifi shield RN171 not compatible with Cayenne?!
Mega2560+ESP8266-01+Cayenne
ESP8266 module and Arduino UNO
Release Notes March 20, 2017 (Android App Update)
Not connecting arduino uno ESP8226 with cayenne
Arduino UNO + ESP8266 -- Not working
Waiting (forever) for board to connect
ESP-12S & Arduino Mega - only one of each can work
Reading Maverick Meat probes
Server error
Connecting the PLCDuino to Cayenne
ESP8266 Wifi + 1 Relay Configuration
Connecting to Cayenne with Sparkfun ESP8266
ESP8266 ESP-01 WIFI Shield for Arduino
Matlab and arduino connected to cayenne
No connection to arduino
ESP8266 ESP-01 WIFI Shield for Arduino
Arduino Mega + Esp8266/or NodeMCU
Arduino Mega + Esp8266/or NodeMCU
Error on Cayenne ESP8266 Code
Help Help!
Arduino Mega 2560 + ESP8266-01
Esp8266 + INA219 + OLED
Connecting Ultrasonic Sensor Using ESP8266
Esp8266 with arduino uno
Arduino with esp8266
Best way to connect Arduino uno to Cayenne
Cant connect nano esp8266
Help with my sketch
Arduino Uno+ESP8266-07+Soft Serial
Add directions for connecting device to internet
#12

lol not sure how I missed that. Selective reading I guess…


#13

I’m just here to keep an eye on you, Adam :stuck_out_tongue:

Cheers,

Kreggly returns to designing his IoT flamethrower.


#14

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


#15

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.


#16

@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


#17

Thanks you so much, I’ll try to do it


#18

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.


#19

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


#20

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.