Using Husarnet under PlatformIO IDE
Migration process from the legacy codebase has been completed 🎉 - the Husarnet library for ESP32 is now available as a proper standalone ESP-IDF component.
The Husarnet embedded library is available for all Espressif Wi-Fi microcontrollers. It allows for a tunneled (simmilar to a classic VPN) or a peer-to-peer connection between your ESP32 devices and other hosts running Husarnet.
Quickstart
Get Platformio
Get platformio and install it. No special plugins are required.
Initialize project
On the Platformio's home screen, click [New Project].
Fill in required data. Board must be from ESP32 family and the only supported framework right now is Arduino.
Add Husarnet to your project
Go to the [Libraries] tab on the Platformio's home screen and search for "Husarnet".
Open [Examples] tab that contains starter project files.
Due to current lack of support of the newest Arduino Core for ESP32 in the Platformio, you'll need to override default platform_packages
in your platformio.ini
file.
Select the platformio example.
Copy contents of the platformio
and simple-webserver
file into your project's platformio.ini
and src/main.cpp
files respectively.
Set your Husarnet join code and Wi-Fi credentials by editing following lines in the main.cpp
file:
// WiFi credentials
#define WIFI_SSID "wifi-network"
#define WIFI_PASS "wifi-password"
// Husarnet credentials
#define HOSTNAME "esp32-pio-webserver"
#define JOIN_CODE "xxxxxxxxxxxxxxxxxxxx"
Build and flash the project using PlatformIO CLI or use the command palette in the PlatformIO IDE.
pio run -t upload
You can use -e
flag to specify which target should be built and uploaded. Currently, the project supports esp32
and esp32-s3
targets. Debugging support is enabled by default for the ESP32-S3 target.