mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
* Fix shell variable comparison without $CI present + '[' = true ']' ./tests/restyle.sh: line 16: [: =: unary operator expected vs. + '[' '' = true ']' * Update to clang-format-18 new opt to skip overly eager macro formatting https://clang.llvm.org/docs/ClangFormatStyleOptions.html#skipmacrodefinitionbody minor changes between 15 and 18 for ide examples reference arduino-ide format is still stuck with 15, though https://github.com/arduino/clang-static-binaries/releases * Pin clang-format in CI recipe not the script itself * style
37 lines
968 B
C++
37 lines
968 B
C++
/*
|
|
This example reads audio data from an Invensense's ICS43432 I2S microphone
|
|
breakout board, and prints out the samples to the Serial console. The
|
|
Serial Plotter built into the Arduino IDE can be used to plot the audio
|
|
data (Tools -> Serial Plotter)
|
|
created 17 November 2016
|
|
by Sandeep Mistry
|
|
*/
|
|
|
|
#include <I2S.h>
|
|
|
|
void setup() {
|
|
// Open serial communications and wait for port to open:
|
|
// A baud rate of 115200 is used instead of 9600 for a faster data rate
|
|
// on non-native USB ports
|
|
Serial.begin(115200);
|
|
while (!Serial) {
|
|
; // wait for serial port to connect. Needed for native USB port only
|
|
}
|
|
|
|
// start I2S at 8 kHz with 24-bits per sample
|
|
if (!I2S.begin(I2S_PHILIPS_MODE, 8000, 24)) {
|
|
Serial.println("Failed to initialize I2S!");
|
|
while (1); // do nothing
|
|
}
|
|
}
|
|
|
|
void loop() {
|
|
// read a sample
|
|
int sample = I2S.read();
|
|
|
|
if (sample) {
|
|
// if it's non-zero print value to serial
|
|
Serial.println(sample);
|
|
}
|
|
}
|