dfrobot Digital Analog Serial PWM programe for XBoard-W7500P
Fork of DFRobotMbedTest by
Revision 5:608466ce27ff, committed 2016-07-15
- Comitter:
- dfrobot
- Date:
- Fri Jul 15 08:15:37 2016 +0000
- Parent:
- 4:d5bf98a13160
- Commit message:
- change to uart0
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d5bf98a13160 -r 608466ce27ff main.cpp --- a/main.cpp Fri Jul 15 07:11:43 2016 +0000 +++ b/main.cpp Fri Jul 15 08:15:37 2016 +0000 @@ -1,6 +1,6 @@ #include "mbed.h" -Serial uart1(PA_13, PA_14); // tx, rx +Serial uart0(PA_13, PA_14); // tx, rx Serial uart2(PC_10, PC_11); // tx, rx DigitalOut myD1(D10); DigitalOut myD2(D11); @@ -35,14 +35,14 @@ } void attimeoutA() { - uart1.printf("A1:%02fV ",myA1.read()*3.3); - uart1.printf("A2:%02fV ",myA2.read()*3.3); - uart1.printf("A3:%02fV \r\n",myA3.read()*3.3); + uart0.printf("A1:%02fV ",myA1.read()*3.3); + uart0.printf("A2:%02fV ",myA2.read()*3.3); + uart0.printf("A3:%02fV \r\n",myA3.read()*3.3); analogTimeout.attach(&attimeoutA,1); } int main() { - uart1.baud(9600); + uart0.baud(9600); uart2.baud(9600); PWM1.period_us(500); PWM2.period_us(500); @@ -51,13 +51,13 @@ PWM2 = 0.5; PWM3 = 0.8; uart2.printf("uart2:for Loopback test,please input something\n"); - uart1.printf("start testing uart1 digitalOut and PWM and analogIn\r\n"); + uart0.printf("start testing digitalOut and PWM and analogIn\r\n"); digitalTimeout.attach(&attimeoutD,0.5); analogTimeout.attach(&attimeoutA,1); while(1) { if (myButton == 0) { - uart1.printf("User Button is Pressed!!!\r\n"); + uart0.printf("User Button is Pressed!!!\r\n"); } if(uart2.readable()){ char ch = uart2.getc();