for test

Dependencies:   mbed

main.cpp

Committer:
jh_ndm
Date:
2016-07-13
Revision:
0:695e35fce077
Child:
1:2cd31d24d6fc

File content as of revision 0:695e35fce077:

/*
#include "mbed.h"
AnalogIn battery(A3);
Serial pc(PA_13,PA_14);
int main(){
    while(1){
        if(battery > 0.5){
            pc.printf("%02f\n",battery.read()*3.3);
            wait(1);
        }
    }
}
*/

/********uart0 demo********
#include "mbed.h"
 
Serial pc(PA_13, PA_14); // tx, rx

int main() {
    pc.printf("Please input something\n");
 
    while(1) {
        char c = pc.getc();
        pc.printf("%s\n",c);
    }
}
*/

/********uart2 demo********
#include "mbed.h"
 
Serial pc(PC_10, PC_11); // tx, rx

int main() {
    pc.printf("Please input something\n");
 
    while(1) {
        char c = pc.getc();
        pc.printf("%s\n",c);
    }
}
*/

/**********Digital demo**********
#include "mbed.h"

DigitalOut num1(D10);
DigitalOut num2(D11);
DigitalOut num3(D12);
DigitalOut num4(D2);
DigitalOut num5(D3);

int main(){
    while(1){
        wait(0.25);
        num1 = 1;
        num2 = 1;
        num3 = 1;
        num4 = 1;
        num5 = 1;
        wait(0.25);
        num1 = 0;
        num2 = 0;
        num3 = 0;
        num4 = 0;
        num5 = 0;
    }    
}
*/

/**********analog demo***********
#include "mbed.h"
AnalogIn battery5(A0);
AnalogIn battery4(PC_9);
AnalogIn battery3(D5);
//Serial pc(PA_13,PA_14);
Serial pc(USBTX,USBRX);
int main(){
    while(1){
        //if(battery3 > 0.5){
           // pc.printf("%f\n",battery3.read()*3.3);
           // wait(0.2);
       // }
        //if(battery4 > 0.5){
          //  pc.printf("%f\n",battery4.read());
            //wait(0.2);
        //}
        if(battery5 > 0.5){
            pc.printf("%f\n",battery5.read());
            wait(0.2);
        }
    }
}
*/


#include"mbed.h"
AnalogIn battery(A2);
Serial pc(USBTX,USBRX);
int main(){
    while(1){
        if(battery > 0.5){
            pc.printf("%f",battery.read());
            wait(1);
        }
    }
}