hi
i'm new to the ESP32 world. I have bought a few ESP32-C6-DevKitC-1.
I have managed to get the "helloworld" in VSCode to get build and flashed.
I have also managed to get the Hardware debugging to work.
But the simple
#include "wifi.h"
couldn't be resolved.
the includes:
#include <stdio.h>
#include <inttypes.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_chip_info.h"
#include "esp_flash.h"
#include "esp_system.h"
#include <esp_now.h>
work like a charm.
Astonishing for me also the
#include "C:/Users/"user"/esp/v5.2.1/esp-idf/components/esp_wifi/include/esp_private/wifi.h"
doesn't work.
What could be wrong or what should i do to get this to work.
thx for helping in advance
hape
include wifi.h can't be resolved in VSCode
-
- Posts: 9708
- Joined: Thu Nov 26, 2015 4:08 am
Re: include wifi.h can't be resolved in VSCode
Why would you need wifi.h in the first place? The 'normal' way to include wifi functions is by including esp_wifi.h.
Re: include wifi.h can't be resolved in VSCode
hi
thx for answering. I understood your point.
But for me (as a beginner in the ESP32 world) it seems to be easier to make
as to make this with the correct esp_wifi.h
it could be that i didn't understand the idea behind the esp_wifi.h . i found https://docs.espressif.com/projects/esp ... _wifi.html as documentation.
thx for clearing my confusionv in advance
hape
thx for answering. I understood your point.
But for me (as a beginner in the ESP32 world) it seems to be easier to make
- #include <WiFi.h>
- Serial.begin(115200);
- Serial.println();
- Serial.print("ESP Board MAC Address: ");
- Serial.println(WiFi.macAddress());
- /*******************************************************************************************
- ESP32: ESP-IDF code creted in VS Code to retrieve the MAC address of the Wifi controller
- Code created by AI and OK1TK with support of the Espressive ESP32 forum
- *******************************************************************************************/
- #include <stdio.h>
- #include "esp_wifi.h"
- #include "esp_log.h"
- #include "nvs_flash.h"
- void app_main()
- {
- esp_err_t ret;
- //Initialize the default NVS partition.
- ret = nvs_flash_init();
- if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
- // If NVS initialization fails due to uncleaned pages or a new version, we clear NVS and try again
- ESP_ERROR_CHECK(nvs_flash_erase());
- ret = nvs_flash_init();
- }
- ESP_ERROR_CHECK(ret);
- // TCP/IP stack initialization
- esp_netif_init();
- esp_event_loop_create_default();
- // Initialization WiFi
- wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
- ret = esp_wifi_init(&cfg);
- if (ret != ESP_OK) {
- ESP_LOGE("WiFi", "WiFi initialization FAILED!: %s", esp_err_to_name(ret));
- return;
- }
- // Retrieving the the MAC address of the WiFi interface
- uint8_t mac[6];
- ret = esp_wifi_get_mac(ESP_IF_WIFI_STA, mac);
- if (ret != ESP_OK) {
- ESP_LOGE("WiFi", "Unable to retrieve the MAC address of the WiFi interface: %s", esp_err_to_name(ret));
- return;
- }
- // Writing the MAC address of the WiFi interface to the terminal
- ESP_LOGI("WiFi", "The WiFi interface MAC address: %02x:%02x:%02x:%02x:%02x:%02x",
- mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
- }C:/Users/hape/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/xtensa-esp-elf/include
thx for clearing my confusionv in advance
hape
Re: include wifi.h can't be resolved in VSCode
Your first code sample is for the Arduino platform and the second is for ESP-IDF. The private wifi.h header in ESP-IDF isn't the same as the WiFi.h header in Arduino and including it won't provide any Arduino-like functionality for your code.
Who is online
Users browsing this forum: No registered users and 26 guests