Aaron Huang
/
waveRx
Receive Analog In signal, and control sampling rate by altering delay time
waveRx.cpp
- Committer:
- aaronice
- Date:
- 2014-02-09
- Revision:
- 0:7a7ab8e73be6
File content as of revision 0:7a7ab8e73be6:
#include "mbed.h" AnalogIn AD(PTB1); Serial pc(USBTX, USBRX); // tx, rx //Global variable, delay time float dt=0; void callback() { pc.printf("Input parameter dt and press Enter:\n"); pc.scanf("%f", &dt); pc.printf("%f\n", dt); pc.printf("Continue...\n"); } int main(void) { //pc.attach(&callback); while(1){ pc.attach(&callback); //Monitor Received Analog In pc.printf("%f ", AD.read()); wait(dt); //wait(3.0); } }