jiang hao
/
DFRobotMbedTest
for test
Diff: main.cpp
- Revision:
- 1:2cd31d24d6fc
- Parent:
- 0:695e35fce077
- Child:
- 2:b67216fc6104
--- a/main.cpp Wed Jul 13 08:47:40 2016 +0000 +++ b/main.cpp Fri Jul 15 01:20:01 2016 +0000 @@ -1,11 +1,11 @@ /* #include "mbed.h" AnalogIn battery(A3); -Serial pc(PA_13,PA_14); +Serial uart1(PA_13,PA_14); int main(){ while(1){ if(battery > 0.5){ - pc.printf("%02f\n",battery.read()*3.3); + uart1.printf("%02f\n",battery.read()*3.3); wait(1); } } @@ -15,14 +15,14 @@ /********uart0 demo******** #include "mbed.h" -Serial pc(PA_13, PA_14); // tx, rx +Serial uart1(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); + char c = uart1.getc(); + uart1.printf("%s\n",c); } } */ @@ -30,14 +30,14 @@ /********uart2 demo******** #include "mbed.h" -Serial pc(PC_10, PC_11); // tx, rx +Serial uart2(PC_10, PC_11); // tx, rx int main() { - pc.printf("Please input something\n"); + uart2.printf("Please input something\n"); while(1) { - char c = pc.getc(); - pc.printf("%s\n",c); + char c = uart2.getc(); + uart2.printf("%s\n",c); } } */ @@ -74,20 +74,20 @@ AnalogIn battery5(A0); AnalogIn battery4(PC_9); AnalogIn battery3(D5); -//Serial pc(PA_13,PA_14); -Serial pc(USBTX,USBRX); +Serial uart1(PA_13,PA_14); +//Serial pc(USBTX,USBRX); int main(){ while(1){ //if(battery3 > 0.5){ - // pc.printf("%f\n",battery3.read()*3.3); + // uart1.printf("%f\n",battery3.read()*3.3); // wait(0.2); // } //if(battery4 > 0.5){ - // pc.printf("%f\n",battery4.read()); + // uart1.printf("%f\n",battery4.read()); //wait(0.2); //} if(battery5 > 0.5){ - pc.printf("%f\n",battery5.read()); + uart1.printf("%f\n",battery5.read()); wait(0.2); } } @@ -97,11 +97,11 @@ #include"mbed.h" AnalogIn battery(A2); -Serial pc(USBTX,USBRX); +Serial uart1(PA_13,PA_14); int main(){ while(1){ if(battery > 0.5){ - pc.printf("%f",battery.read()); + uart1.printf("%f",battery.read()); wait(1); } }