-->
Page 1 of 3

Connecting esp8266 to a web server

PostPosted: Fri Aug 19, 2016 12:43 pm
by nimafas
hi everyone
I'm trying to connect some esp8266's to a web server. I tried to search, but it couldn't help me out. I'll thank you if you teach me how or give a link from an article to read it
what i have done till now is that i connected to an android phone, nothing more. and I'm using arduino

Re: Connecting esp8266 to a web server

PostPosted: Fri Aug 19, 2016 1:53 pm
by martinayotte
Take a look at this ArduinoESP example :
https://github.com/esp8266/Arduino/blob ... Client.ino

Re: Connecting esp8266 to a web server

PostPosted: Mon Aug 22, 2016 7:12 am
by nimafas
sorry I didn't ask this earlier, but i can't compile the code. I've downloaded the library esp8266wifi but there are several errors when i try to compile. can you help me about it?

Re: Connecting esp8266 to a web server

PostPosted: Mon Aug 22, 2016 8:44 am
by nimafas
thanks for the example, i downloaded the library but i have this problem:
1.when i compile the code, IDE sends me this error:
/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:23:19: fatal error: queue.h: No such file or directory
#include <queue.h>

2.i comment #include <queue.h> and then this error comes up:
/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h:24:22: fatal error: functional: No such file or directory
#include <functional>

3.commenting #include <functional> and then i have this:
/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h:24:22: fatal error: functional: No such file or directory
#include <functional>

4.after commenting functional, i face this one:
/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h:25:18: fatal error: memory: No such file or directory
#include <memory>

5. then another #include <memory> but this time in wificlient:
/Arduino/libraries/ESP8266WiFi/src/WiFiClient.h:20:18: fatal error: memory: No such file or directory
#include <memory>

6. afterwards! i face this :
WARNING: library ESP8266WiFi claims to run on [esp8266] architecture(s) and may be incompatible with your current board which runs on [avr] architecture(s).
In file included from /Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFi.h:30:0,
from /Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino:9:
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:105:5: error: 'uint8' does not name a type
uint8 bssid[6];

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:106:5: error: 'uint8' does not name a type
uint8 channel;

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:112:5: error: 'uint8' does not name a type
uint8 bssid[6];

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:118:5: error: 'uint8' does not name a type
uint8 oldMode;

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:119:5: error: 'uint8' does not name a type
uint8 newMode;

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:131:5: error: 'uint8' does not name a type
uint8 mac[6];

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:132:5: error: 'uint8' does not name a type
uint8 aid;

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:137:5: error: 'uint8' does not name a type
uint8 mac[6];

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:138:5: error: 'uint8' does not name a type
uint8 aid;

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:144:5: error: 'uint8' does not name a type
uint8 mac[6];

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:149:20: error: ISO C++ forbids declaration of 'STAILQ_HEAD' with no type [-fpermissive]
typedef STAILQ_HEAD(, bss_info)

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:149:20: error: typedef 'STAILQ_HEAD' is initialized (use decltype instead)
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:149:21: error: expected primary-expression before ',' token
typedef STAILQ_HEAD(, bss_info)

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiType.h:149:23: error: 'bss_info' was not declared in this scope
typedef STAILQ_HEAD(, bss_info)

^
In file included from /Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h:26:0,
from /Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFi.h:31,
from /Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino:9:
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h:38:9: error: 'shared_ptr' in namespace 'std' does not name a type
typedef std::shared_ptr<WiFiEventHandlerOpaque> WiFiEventHandler;

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h:54:9: error: 'WiFiEventHandler' does not name a type
WiFiEventHandler onStationModeConnected(std::function<void(const WiFiEventStationModeConnected&)>);

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h:55:9: error: 'WiFiEventHandler' does not name a type
WiFiEventHandler onStationModeDisconnected(std::function<void(const WiFiEventStationModeDisconnected&)>);

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h:56:9: error: 'WiFiEventHandler' does not name a type
WiFiEventHandler onStationModeAuthModeChanged(std::function<void(const WiFiEventStationModeAuthModeChanged&)>);

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h:57:9: error: 'WiFiEventHandler' does not name a type
WiFiEventHandler onStationModeGotIP(std::function<void(const WiFiEventStationModeGotIP&)>);

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h:58:9: error: 'WiFiEventHandler' does not name a type
WiFiEventHandler onStationModeDHCPTimeout(std::function<void(void)>);

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h:59:9: error: 'WiFiEventHandler' does not name a type
WiFiEventHandler onSoftAPModeStationConnected(std::function<void(const WiFiEventSoftAPModeStationConnected&)>);

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h:60:9: error: 'WiFiEventHandler' does not name a type
WiFiEventHandler onSoftAPModeStationDisconnected(std::function<void(const WiFiEventSoftAPModeStationDisconnected&)>);

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.h:81:30: error: 'uint32' has not been declared
bool forceSleepBegin(uint32 sleepUs = 0);

^
In file included from /Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFi.h:33:0,
from /Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino:9:
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiScan.h:35:37: error: 'std::function' has not been declared
void scanNetworksAsync(std::function<void(int)> onComplete, bool show_hidden = false);

^
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiScan.h:35:45: error: expected ',' or '...' before '<' token
void scanNetworksAsync(std::function<void(int)> onComplete, bool show_hidden = false);

^
In file included from /Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFi.h:33:0,
from /Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino:9:
/Users/Nima/Documents/Arduino/libraries/ESP8266WiFi/src/ESP8266WiFiScan.h:60:16: error: 'function' in namespace 'std' does not name a type
static std::function<void(int)> _onComplete;

^
exit status 1
Error compiling.

well i think these are some stuff with the library, and i don't know how to fix it.
.
and another thing, i connect esp to arduino uno like this, is that alright?
GND - GND
GPIO and GPIO2 - NC
VCC, RST and CH_PD - 3.3v
RX - 3
TX - 2
I really appreciate if you help me out :)