42 lines
868 B
C++
42 lines
868 B
C++
/**
|
|
* @file example-espnow-receive.ino
|
|
* @author Phil Schatzmann
|
|
* @brief Receiving audio via ESPNow
|
|
* @version 0.1
|
|
* @date 2022-03-09
|
|
*
|
|
* @copyright Copyright (c) 2022
|
|
*/
|
|
|
|
#include "AudioTools.h"
|
|
#include "AudioTools/Communication/ESPNowStream.h"
|
|
|
|
AudioInfo info(8000, 1, 16);
|
|
ESPNowStream now;
|
|
MeasuringStream now1(now);
|
|
|
|
I2SStream out;
|
|
StreamCopy copier(out, now1);
|
|
const char *peers[] = {"A8:48:FA:0B:93:02"};
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
|
|
|
auto cfg = now.defaultConfig();
|
|
cfg.mac_address = "A8:48:FA:0B:93:01";
|
|
now.begin(cfg);
|
|
now.addPeers(peers);
|
|
|
|
// start I2S
|
|
Serial.println("starting I2S...");
|
|
auto config = out.defaultConfig(TX_MODE);
|
|
config.copyFrom(info);
|
|
out.begin(config);
|
|
|
|
Serial.println("Receiver started...");
|
|
}
|
|
|
|
void loop() {
|
|
copier.copy();
|
|
} |