This library is designed to provide a simple API in order to communicate electronic badges over a WiFi mesh network. It works using the ESPNOW protocol developed by Espressif Systems.
- Send and receive messages between badges (messages can be of any data type)
- Set the badge's type (e.g. "BSides", "DragonJAR", "Ekoparty", and "BugCON")
- Get the badge's type
- At least two ESP32 development boards
- ESP-IDF installed in your computer
make
installed in your computer (optional)
Add badge_connect_bin as a git submodule in your project.
git submodule add https://github.com/ElectronicCats/badge_connect_bin.git firmware/components/badge_connect
- Include the library in your source code.
#include "badge_connect.h"
- Initialize the library in your code.
badge_connect_init();
- Implement the callback function that will be called when a message is received.
void receive_data_cb(badge_connect_recv_msg_t* msg) {
// Do something with the received message
}
- Register the callback function.
badge_connect_register_recv_cb(receive_data_cb);
- Set the badge's type, choose one of the following:
badge_connect_set_bsides_badge();
badge_connect_set_dragonjar_badge();
badge_connect_set_ekoparty_badge();
badge_connect_set_bugcon_badge();
- Send a message to another badge.
char* data = "Hello, world!";
badge_connect_send(data, strlen(data));
- Compile and flash!
There is a folder called examples
in this repository, you can use the Makefile
in each example to compile and flash the firmware.
- Get
idf.py
to your terminal session, if you followed the Espressif IDF installation guide, useget_idf
.
get_idf
- Go to the example folder you want to compile. For example, the
send_int
one.
cd examples/send_int
- Set the board type you are using, skip if you are using an
ESP32
. For example,ESP32-C6
.
idf.py set-target esp32c6
- Set the serial port where the board is connected. For example,
/dev/ttyUSB0
.
export PORT=/dev/ttyUSB0
- Compile, flash, and monitor the output.
make all
Electronic Cats invests time and resources in providing this open-source design, please support Electronic Cats and open-source hardware by purchasing products from Electronic Cats!
Designed by Electronic Cats.
This library is released under a GNU AGPL v3.0 license. See the LICENSE file for more information.
Electronic Cats is a registered trademark, please do not use if you sell these PCBs.
June 2024