snapshot
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
# Display RAW Stream
|
||||
|
||||
Sometimes it is handy to check out the data on the screen with the help of the Arduino Serial Monitor and Serial Plotter.
|
||||
We read the raw binary data from an URLStream.
|
||||
|
||||
As output stream we use a CsvOutput: this class transforms the data into CSV and prints the result to Serial. Finally we can use the Arduino Serial Plotter to view the result as chart:
|
||||
|
||||

|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* @file streams-url_raw-serial.ino
|
||||
* @author Phil Schatzmann
|
||||
* @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-stream/streams-url_raw-serial/README.md
|
||||
* @author Phil Schatzmann
|
||||
* @copyright GPLv3
|
||||
*/
|
||||
|
||||
#include "WiFi.h"
|
||||
#include "AudioTools.h"
|
||||
#include "AudioTools/Communication/AudioHttp.h"
|
||||
|
||||
|
||||
|
||||
URLStream music; // Music Stream
|
||||
int channels = 2; // The stream has 2 channels
|
||||
CsvOutput<int16_t> printer(Serial, channels); // ASCII stream
|
||||
StreamCopy copier(printer, music); // copies music into printer
|
||||
|
||||
// Arduino Setup
|
||||
void setup(void) {
|
||||
// Open Serial
|
||||
Serial.begin(115200);
|
||||
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
|
||||
|
||||
// connect to WIFI
|
||||
WiFi.begin("network-name", "password");
|
||||
while (WiFi.status() != WL_CONNECTED){
|
||||
Serial.print(".");
|
||||
delay(500);
|
||||
}
|
||||
|
||||
// open music stream - it contains 2 channels of int16_t data
|
||||
music.begin("https://pschatzmann.github.io/Resources/audio/audio.raw");
|
||||
}
|
||||
|
||||
|
||||
// Arduino loop - repeated processing
|
||||
void loop() {
|
||||
copier.copy();
|
||||
}
|
||||
Reference in New Issue
Block a user