Aaron Huang / Mbed 2 deprecated waveRx

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers waveRx.cpp Source File

waveRx.cpp

00001 #include "mbed.h"
00002 
00003 AnalogIn AD(PTB1);
00004 Serial pc(USBTX, USBRX); // tx, rx
00005 
00006 //Global variable, delay time
00007 float dt=0;
00008 
00009 void callback() {
00010     
00011     pc.printf("Input parameter dt and press Enter:\n");
00012     pc.scanf("%f", &dt);
00013     pc.printf("%f\n", dt);
00014     pc.printf("Continue...\n");
00015     
00016     }
00017     
00018     
00019        
00020 int main(void) {
00021         
00022     
00023     //pc.attach(&callback);
00024     
00025     while(1){
00026         
00027             pc.attach(&callback);
00028             
00029             //Monitor Received Analog In
00030             pc.printf("%f ", AD.read());
00031             wait(dt);
00032            //wait(3.0);
00033     }
00034 }