I need help understanding what the error messages mean, so I can fix them.
Here's the error message from arduin ide:
Arduino: 1.6.8 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Serial, 115200, 4M (3M SPIFFS)"
In file included from C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:29:0:
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.h:25:0: warning: "UDP_TX_PACKET_MAX_SIZE" redefined [enabled by default]
#define UDP_TX_PACKET_MAX_SIZE 24
^
In file included from C:\Program Files\Arduino\libraries\WiFi\src\utility/wifi_drv.h:26:0,
from C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:26:
C:\Users\Donovan\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0\libraries\ESP8266WiFi\src/WiFiUdp.h:28:0: note: this is the location of the previous definition
#define UDP_TX_PACKET_MAX_SIZE 8192
^
In file included from C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:29:0:
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.h:27:7: error: redefinition of 'class WiFiUDP'
class WiFiUDP : public UDP {
^
In file included from C:\Program Files\Arduino\libraries\WiFi\src\utility/wifi_drv.h:26:0,
from C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:26:
C:\Users\Donovan\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.0.0\libraries\ESP8266WiFi\src/WiFiUdp.h:32:7: error: previous definition of 'class WiFiUDP'
class WiFiUDP : public UDP, public SList<WiFiUDP> {
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp: In constructor 'WiFiUDP::WiFiUDP()':
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:35:22: error: class 'WiFiUDP' does not have any field named '_sock'
WiFiUDP::WiFiUDP() : _sock(NO_SOCKET_AVAIL) {}
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual uint8_t WiFiUDP::begin(uint16_t)':
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:45:9: error: '_sock' was not declared in this scope
_sock = sock;
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:46:9: error: '_port' was not declared in this scope
_port = port;
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual int WiFiUDP::available()':
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:56:7: error: '_sock' was not declared in this scope
if (_sock != NO_SOCKET_AVAIL)
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual void WiFiUDP::stop()':
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:66:8: error: '_sock' was not declared in this scope
if (_sock == NO_SOCKET_AVAIL)
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:69:26: error: '_sock' was not declared in this scope
ServerDrv::stopClient(_sock);
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual int WiFiUDP::beginPacket(IPAddress, uint16_t)':
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:88:7: error: '_sock' was not declared in this scope
if (_sock == NO_SOCKET_AVAIL)
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:90:7: error: '_sock' was not declared in this scope
if (_sock != NO_SOCKET_AVAIL)
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual int WiFiUDP::endPacket()':
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:101:32: error: '_sock' was not declared in this scope
return ServerDrv::sendUdpData(_sock);
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual size_t WiFiUDP::write(const uint8_t*, size_t)':
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:111:27: error: '_sock' was not declared in this scope
ServerDrv::insertDataBuf(_sock, buffer, size);
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual int WiFiUDP::read()':
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:125:23: error: '_sock' was not declared in this scope
ServerDrv::getData(_sock, &b);
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual int WiFiUDP::read(unsigned char*, size_t)':
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:137:31: error: '_sock' was not declared in this scope
if (!ServerDrv::getDataBuf(_sock, buffer, &size))
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual int WiFiUDP::peek()':
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:152:22: error: '_sock' was not declared in this scope
ServerDrv::getData(_sock, &b, 1);
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual IPAddress WiFiUDP::remoteIP()':
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:166:25: error: '_sock' was not declared in this scope
WiFiDrv::getRemoteData(_sock, _remoteIp, _remotePort);
^
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp: In member function 'virtual uint16_t WiFiUDP::remotePort()':
C:\Program Files\Arduino\libraries\WiFi\src\WiFiUdp.cpp:176:25: error: '_sock' was not declared in this scope
WiFiDrv::getRemoteData(_sock, _remoteIp, _remotePort);
^
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
And here is my code:
/*
Web client
This sketch connects to a website (http://www.google.com)
using a WiFi shield.
This example is written for a network using WPA encryption. For
WEP or WPA, change the Wifi.begin() call accordingly.
This example is written for a network using WPA encryption. For
WEP or WPA, change the Wifi.begin() call accordingly.
Circuit:
* WiFi shield attached
created 13 July 2010
by dlf (Metodo2 srl)
modified 31 May 2012
by Tom Igoe
*/
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>
#include <SPI.h>
#include <WiFi.h>
#include <ArduinoJson.h>
char ssid[] = "donowifi"; // your network SSID (name)
char pass[] = "wifipassword"; // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0; // your network key Index number (needed only for WEP)
int status = WL_IDLE_STATUS;
// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(74,125,232,128); // numeric IP for Google (no DNS)
char server[] = "www.google.com"; // name address for Google (using DNS)
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
WiFiClient client;
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while(true);
}
// attempt to connect to Wifi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}
Serial.println("Connected to wifi");
Serial.println("\nStarting connection to server...");
// if you get a connection, report back via serial:
if (client.connect(server, 80)) {
Serial.println("connected to server");
// Make a HTTP request:
client.println("GET /json-api/getIbleStats?id=ECGWVGJIZ6E2YEQ HTTP/1.1");
client.println("Host: www.instructables.com");
client.println("Connection: close");
client.println();
}
}
void loop() {
// if there are incoming bytes available
// from the server, read them and print them:
while (client.available()) {
char c = client.read();
Serial.write(c);
const size_t bufferSize = JSON_OBJECT_SIZE(3) + 40;
DynamicJsonBuffer jsonBuffer(bufferSize);
const char* json = "{\"views\":4429,\"favorites\":62,\"comments\":4}";
JsonObject& root = jsonBuffer.parseObject(json);
int views = root["views"]; // 4429
int favorites = root["favorites"]; // 62
//int comments = root["comments"]; // 4
Serial.print(views);
Serial.print(favorites);
}
// if the server's disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting from server.");
client.stop();
// do nothing forevermore:
while(true);
}
}