| 12345678910111213141516171819202122232425262728293031323334353637 |
- #include "Arduino.h"
- #include "EspNowSerial/EspNowSerial.h"
- #include "InterSerialBridge/InterSerialBridge.h"
- EspMacAddress peer_addr = {0x9c, 0x9e, 0x6e, 0xe0, 0x87, 0xf4};
- CcmpMasterKey pmk = {0x2a, 0xc9, 0xe6, 0x4e, 0x36, 0x4c, 0xa7, 0xf4, 0xca, 0xd0, 0x4a, 0xdd, 0x34, 0xc2, 0x28, 0x25};
- CcmpMasterKey lmk = {0x8c, 0xd3, 0xa5, 0x7a, 0x25, 0xdf, 0x92, 0x45, 0x2a, 0xf3, 0xd5, 0x0d, 0x56, 0xc8, 0x3c, 0x34};
- EspNowSerial EnSerial(WIFI_MODE_STA);
- InterSerialBridge<1024> SerialBridge(Serial, EnSerial);
- void setup()
- {
- // Initialize HW Serial
- Serial.begin(921600);
- // Initialize ESP-NOW as serial
- uint8_t status = EnSerial.begin(11, false, pmk);
- status += EnSerial.add_peer_encrypted(peer_addr, lmk);
- // Init ESP-NOW
- if (status != ESP_OK)
- {
- while (1)
- {
- delay(1000);
- }
- }
- }
-
- void loop()
- {
- // process bridge stack
- SerialBridge.loop_callback();
- }
|