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.
main.cpp
- Committer:
- philiptimson
- Date:
- 2010-08-15
- Revision:
- 0:2d75e8930b10
File content as of revision 0:2d75e8930b10:
#include "mbed.h"
DigitalOut detect(LED1);
DigitalOut peaked(LED2);
AnalogIn signal(p20);
#define threshold 0.5
#define peak 0.99
int main() {
while (1) {
printf("%f\n", signal.read());
if (signal.read() > threshold) detect=1; //turn on detect LED if the signal is greater than the threshold
else {detect=0;}
if (signal.read() > peak) peaked=1; // turn on peaked LED if the signal is too high
else peaked = 0;
wait(0.01);
}
}