For Arduino Due
Simple Wireless Speaker:
Demonstration of a single wireless speaker/wireless audio
The incoming audio format is 16bit mono
NRF24L01+ radios can support around 16-44khz sample rate w/16-bit samples, 88khz+ with 8-bit samples
- Note
- This code depends on radio.h located in the same directory.
#include <RF24.h>
#include "myRadio.h"
void DACC_Handler(void) {
}
void setup() {
Serial.begin(115200);
Serial.println("Analog Audio Begin");
setupRadio();
}
uint32_t dispTimer = 0;
uint8_t channelSelection = 0;
void loop() {
if (millis() - dispTimer > 3000) {
dispTimer = millis();
TcChannel * t = &(TC0->TC_CHANNEL)[0];
TcChannel * tt = &(TC0->TC_CHANNEL)[1];
Serial.print("Ch0:");
Serial.println(t->TC_RC);
Serial.print("Ch1:");
Serial.println(tt->TC_RC);
}
if (Serial.available()) {
char dat = Serial.read();
switch (dat) {
case '0': channelSelection = 0; break;
case '1': channelSelection = 1; break;
case '2': channelSelection = 2; break;
}
}
}
uint32_t dynSampleRate = 0;
void RX() {
while (radio.available(&pipeNo)) {
if (pipeNo == 2) {
radio.read(&dynSampleRate, 4);
} else {
for (int i = 0; i < 16; i++) {
}
aaAudio.
feedDAC(channelSelection, 16);
}
}
}
void setSampleRate(uint32_t sampRate=0, bool stereo=false)
uint16_t dacBuffer16[MAX_BUFFER_SIZE]
void begin(uint8_t enADC, uint8_t enDAC, uint8_t _useI2S=0)
void feedDAC(uint8_t dacChannel=0, uint32_t samples=MAX_BUFFER_SIZE, bool startInterrupts=false)