Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
PingDetect/PingDetect.h
- Committer:
- tummastt
- Date:
- 2012-07-30
- Revision:
- 0:efb27fbc92c0
- Child:
- 1:227db871d328
File content as of revision 0:efb27fbc92c0:
/*
*/
#ifndef PINGDETECT_H
#define PINGDETECT_H
#include "mbed.h"
#include "../Parameters.h"
#include "mbedADC.h"
#include "FFT.h"
class PingDetect {
public:
PingDetect () : pc(USBTX, USBRX), adc(mbedSAMPLE_RATE,1), l0(LED1), local("local"),TempCmd(0) {
pc.baud(921600);
//Set up ADC on pin 20
adc.setup(p20,1);
//Set up ADC on pin 19
adc.setup(p19,1);
noOfSamples = ((float)SAMPLE_RATE)*TIME/1000;
for(i=0; i<noOfSamples; i++){
DataFront[i]=0;
DataBack[i]=0;
}
pc.printf("%i", noOfSamples);
no = 0;
}
int Search();
/*
*/
void Run();
/*
*/
void CalculateFFT();
/*
*/
int ReadSerial(int cmd);
void SendSerial(int cmd);
short DataFront[SAMPLE_RATE*TIME/1000];
short DataBack[SAMPLE_RATE*TIME/1000];
int noOfSamples;
private:
// PC serial connection
Serial pc;
FFT fft;
mbedADC adc;
DigitalOut l0;
LocalFileSystem local;
char TempCmd;
int i,k, no;
};
#endif