arduino:spektrumanalysator:programmversion_0.2
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
arduino:spektrumanalysator:programmversion_0.2 [02.09.2017 18:55] – angelegt Frickelpiet | arduino:spektrumanalysator:programmversion_0.2 [18.05.2023 12:34] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 4: | Zeile 4: | ||
https:// | https:// | ||
+ | < | ||
+ | // | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | // | ||
+ | #define encoderChannelA | ||
+ | #define encoderChannelB | ||
+ | Encoder myEnc(encoderChannelA, | ||
+ | |||
+ | long newPosition = 0; | ||
+ | long oldPosition; | ||
+ | |||
+ | // GUItool: begin automatically generated code | ||
+ | AudioInputAnalog | ||
+ | AudioAnalyzePeak | ||
+ | AudioAnalyzeFFT1024 | ||
+ | AudioConnection | ||
+ | AudioConnection | ||
+ | // GUItool: end automatically generated code | ||
+ | |||
+ | void setup() { | ||
+ | Serial.begin(115200); | ||
+ | | ||
+ | AudioMemory(10); | ||
+ | // Configure the window algorithm to use | ||
+ | fft1024_1.windowFunction(AudioWindowHanning1024); | ||
+ | // | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | // Encoder | ||
+ | newPosition = myEnc.read(); | ||
+ | if (newPosition != oldPosition) { | ||
+ | oldPosition = newPosition; | ||
+ | // | ||
+ | } | ||
+ | | ||
+ | // FFT | ||
+ | float n; | ||
+ | int i; | ||
+ | |||
+ | if (fft1024_1.available()) { | ||
+ | // each time new FFT data is available | ||
+ | // print it all to the Arduino Serial Monitor | ||
+ | Serial.print(" | ||
+ | for (i=0; i<40; i++) { | ||
+ | n = fft1024_1.read(i); | ||
+ | if (n >= 0.01) { | ||
+ | Serial.print(n); | ||
+ | Serial.print(" | ||
+ | } else { | ||
+ | Serial.print(" | ||
+ | } | ||
+ | } | ||
+ | | ||
+ | |||
+ | if (peak1.available()) { | ||
+ | int monoPeak = peak1.read() * 30.0; | ||
+ | Serial.print(" | ||
+ | Serial.print(monoPeak); | ||
+ | } | ||
+ | | ||
+ | // Serieller Output | ||
+ | // | ||
+ | // | ||
+ | // | ||
+ | // | ||
+ | Serial.print(" | ||
+ | Serial.print(newPosition); | ||
+ | Serial.println(); | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | {{tag> |
arduino/spektrumanalysator/programmversion_0.2.1504371356.txt.gz · Zuletzt geändert: 18.05.2023 12:16 (Externe Bearbeitung)