/************************************************************************************************* PROGRAMMINFO ************************************************************************************************** Funktion: ESP32 NOW Empfänger ************************************************************************************************** Version: 18.09.2021 ************************************************************************************************** Board: ESP32vn IoT UNO V1.0.4 ************************************************************************************************** C++ Arduino IDE V1.8.13 ************************************************************************************************** Einstellungen: https://dl.espressif.com/dl/package_esp32_index.json http://dan.drown.org/stm32duino/package_STM32duino_index.json https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json ************************************************************************************************** Librarys - WiFi.h V0.16.1 ************************************************************************************************** **************************************************************************************************/ #include #include typedef struct struct_message { char character[100]; int integer; float floating_value; bool bool_value; } struct_message; struct_message message; void data_receive(const uint8_t * mac, const uint8_t *incomingData, int len) { memcpy(&message, incomingData, sizeof(message)); Serial.print("Bytes received: "); Serial.println(len); Serial.print("Char: "); Serial.println(message.character); Serial.print("Int: "); Serial.println(message.integer); Serial.print("Float: "); Serial.println(message.floating_value); Serial.print("Bool: "); Serial.println(message.bool_value); Serial.println(); } void setup() { Serial.begin(115200); WiFi.mode(WIFI_STA); if (esp_now_init() != ESP_OK) { Serial.println("Error initializing ESP-NOW"); return; } esp_now_register_recv_cb(data_receive); } void loop() { }