#include "mbed.h"
DigitalOut myled(LED_GREEN);
//Serial pc(USBTX, USBRX);
Serial pc(PTB17, PTB16);
Serial uart1(PTC4, PTC3);
Serial uart2(PTD3, PTD2);
Serial uart3(PTC17, PTC16);
int main()
{
int i = 0;
pc.printf("Hello World!\n");
uart1.printf("Hello World! UART1\n");
uart2.printf("Hello World! UART2\n");
uart3.printf("Hello World! UART3\n");
while (true) {
wait(0.5f); // wait a small period of time
pc.printf("%d \n", i); // print the value of variable i
uart1.printf("%d \n", i);
uart2.printf("%d \n", i);
uart3.printf("%d \n", i);
i++; // increment the variable
myled = !myled; // toggle a led
}
}
除了虚拟串口之外,我连接了 2 条串口线同时显示 3 个串口输出。
FRDM-K64F 的管脚配置
|