VSC+PIO can't get ESP8266WiFi working here

As per subject. Mind please that exact capitalization of the name. I need specifically ESP8266WiFi lib funcionality here, but for a life of mine I am unable to get it working in VSC+PIO.

ESP8266WiFi is available on github as a part of all encompassing Arduino library. I have installed it all by:
platformio lib -g install GitHub - esp8266/Arduino: ESP8266 core for Arduino
but needed to modify path (move folders) to get ESP8266WiFi.h avail for #include. Then build attempt spat the next error:

ESP8266WiFiType.h fatal error queue.h No such file or director

Tried to point various queue.h files but failed. Hence, I gather that way also was wrong.

Q: how do I install ESP8266WiFi properly to use under VSC+PIO ?

You should not include the ESP8266-Arduino framework as a “library” in PIO. It’s a framework which is selected by the framework = arduino directive in the platformio.ini.

I have no problems compiling the basic WiFi scanner sketch as they’ve provided in the examples for the ESP8266WiFi library.

platformio.ini:

[env:esp8266]
monitor_speed = 115200
platform = espressif8266
board = nodemcuv2
framework = arduino

src\main.cpp code from the example.

The LDF finds the lib (as it’s builtin in the ESP8266-Arduino framework) and compiles it:

Processing esp8266 (platform: espressif8266; board: nodemcuv2; framework: arduino)
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 2.2.3 > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES: toolchain-xtensa 2.40802.190218 (4.8.2), tool-esptool 1.413.0 (4.13), tool-esptoolpy 1.20600.0 (2.6.0), framework-arduinoespressif8266 2.20502.0 (2.5.2)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 28 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ESP8266WiFi> 1.0 (C:\Users\Maxi\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi)
[...]
DATA:    [===       ]  32.8% (used 26852 bytes from 81920 bytes)
PROGRAM: [===       ]  25.4% (used 264936 bytes from 1044464 bytes)
 [SUCCESS] Took 10.59 seconds 

Note that if you want the most-recent bleeding edge version of ESP8266-Arduino, you need to override the framework-arduinoespressif8266 package, as shown in the docs.

Please report the error you’re getting when you reproduce my example above and if the functionality you want to have there is available.

1 Like

Thank you for the framework disambiguation.

I have failed to mention that it is setup for TTGO-T1 board.
The closest platformio.ini is like that:

[env:esp8266]
monitor_speed = 115200
platform = espressif32
board = ttgo-t1
framework = arduino

However it gives two different errors with the platform settings:

platform = espressif8266 <- Error: Unknown board ID ‘ttgo-t1’

makes sense, since TTGO-T1 is ESP32 based.

platform = espressif32 <- fatal error: queue.h: No such file or directory

Full path to the requesting file:

**/home/user/.platformio/lib/ESP8266WiFi/src/ESP8266WiFiType.h:26:19: fatal error: queue.h: No such file or directory
**
Building example you pointed out gives the same error.

What would be the correct platformio.ini in this case ?

First thing to work out is exactly what board is it you’re trying to do this with, and then what is the right code to be using. As you pointed out, the TTGO-T1 is an ESP32 board. This means that any ESP8266-specific code and libraries will NOT work with it. Case in point - the ESP8266WiFi library… it’s in the name :wink: For the ESP32 Arduino core, you should be using #include <Wifi.h> and following the relevant example.

2 Likes

Painfully obvious. Excuse my brainfart. =)

1 Like