From 505520d83b59e74cb567a3a1e6e55d910faec522 Mon Sep 17 00:00:00 2001 From: Finlay Davidson Date: Sun, 28 May 2023 03:03:49 +0200 Subject: arduinofft: Move to submodule, define srqt_internal externally --- .../arduinoFFT-develop/Examples/FFT_03/FFT_03.ino | 114 --------------------- 1 file changed, 114 deletions(-) delete mode 100644 src/libs/arduinoFFT-develop/Examples/FFT_03/FFT_03.ino (limited to 'src/libs/arduinoFFT-develop/Examples/FFT_03') diff --git a/src/libs/arduinoFFT-develop/Examples/FFT_03/FFT_03.ino b/src/libs/arduinoFFT-develop/Examples/FFT_03/FFT_03.ino deleted file mode 100644 index ee2b2946..00000000 --- a/src/libs/arduinoFFT-develop/Examples/FFT_03/FFT_03.ino +++ /dev/null @@ -1,114 +0,0 @@ -/* - - Example of use of the FFT libray to compute FFT for a signal sampled through the ADC. - - Copyright (C) 2018 Enrique Condés and Ragnar Ranøyen Homb - Copyright (C) 2020 Bim Overbohm (header-only, template, speed improvements) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -*/ - -#include "arduinoFFT.h" - -/* -These values can be changed in order to evaluate the functions -*/ -#define CHANNEL A0 -const uint16_t samples = 64; //This value MUST ALWAYS be a power of 2 -const double samplingFrequency = 100; //Hz, must be less than 10000 due to ADC -unsigned int sampling_period_us; -unsigned long microseconds; - -/* -These are the input and output vectors -Input vectors receive computed results from FFT -*/ -double vReal[samples]; -double vImag[samples]; - -/* Create FFT object */ -ArduinoFFT FFT = ArduinoFFT(vReal, vImag, samples, samplingFrequency); - -#define SCL_INDEX 0x00 -#define SCL_TIME 0x01 -#define SCL_FREQUENCY 0x02 -#define SCL_PLOT 0x03 - -void setup() -{ - sampling_period_us = round(1000000*(1.0/samplingFrequency)); - Serial.begin(115200); - Serial.println("Ready"); -} - -void loop() -{ - /*SAMPLING*/ - microseconds = micros(); - for(int i=0; i> 1), SCL_FREQUENCY); - double x = FFT.majorPeak(); - Serial.println(x, 6); //Print out what frequency is the most dominant. - while(1); /* Run Once */ - // delay(2000); /* Repeat after delay */ -} - -void PrintVector(double *vData, uint16_t bufferSize, uint8_t scaleType) -{ - for (uint16_t i = 0; i < bufferSize; i++) - { - double abscissa; - /* Print abscissa value */ - switch (scaleType) - { - case SCL_INDEX: - abscissa = (i * 1.0); - break; - case SCL_TIME: - abscissa = ((i * 1.0) / samplingFrequency); - break; - case SCL_FREQUENCY: - abscissa = ((i * 1.0 * samplingFrequency) / samples); - break; - } - Serial.print(abscissa, 6); - if(scaleType==SCL_FREQUENCY) - Serial.print("Hz"); - Serial.print(" "); - Serial.println(vData[i], 4); - } - Serial.println(); -} -- cgit v1.2.3-70-g09d2