GithubHelp home page GithubHelp logo

cvonk / esp32_wifi-connect Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 30 KB

Reusable ESP-IDF module for reliable Wi-Fi connect (and if necessary reconnect)

License: Creative Commons Zero v1.0 Universal

C 100.00%
esp-idf esp32 wifi esp-idf-component

esp32_wifi-connect's Introduction

ESP32 - Connect to WiFi Access Point

GitHub Discussions GitHub tag (latest by date) GitHub

Goal

The ESP-IDF API

provides support for WiFi Station mode (aka STA mode or WiFi client mode). ESP32 connects to an access point.

This component makes this API available as a component. It connects to a WiFi Access Point, and reconnects when the connection drops.

The user can specify event handlers to respond to connect/disconnect events to e.g. start/stop a HTTP server.

Example

An example can be found in the test directory.

The WIFI_CONNECT_SSID and WIFI_CONNECT_PASSWORD can be provisioned using Kconfig. If empty, the device will use credentials from flash memory instead. Once connected to an WiFi Access Point, it starts a web server.

Usage

The software relies on the master ESP-IDF SDK version v4.3-dev-472-gcf056a7d0 and accompanying tools.

Clone this component in your project's components directory, or use it as a git submodule.

git submodule add -b master https://github.com/cvonk/ESP32_wifi-connect.git components/wifi_connect
git submodule init

Copy the Kconfig.example into your Kconfig and update the configuration.

First initialize non volatile flash memory (nvs_flash_init). Then create invoke the component as

wifi_connect_config_t wifi_connect_config = {
    .onConnect = _wifi_connect_on_connect,
    .onDisconnect = _wifi_connect_on_disconnect,
    .priv = NULL,
};
wifi_connect(&wifi_connect_config);

Here _wifi_connect_on_connect and _wifi_connect_on_disconnect are user supplied callback functions. The element priv is intended to private data used in these callback functions.

Feedback

I love to hear from you. Please use the Github discussion board to contact me.

esp32_wifi-connect's People

Contributors

cvonk avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

smartnimbus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.