![](/media/cache/profiles/Cristian_Castro_-_Foto.jpg.50x50_q85.jpg)
Envía un mensaje a través de la UART al PC.
main.cpp@0:d8d41ed737a3, 2021-09-03 (annotated)
- Committer:
- CCastrop1012
- Date:
- Fri Sep 03 04:44:06 2021 +0000
- Revision:
- 0:d8d41ed737a3
Envia un mensaje a traves de la UART al PC
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
CCastrop1012 | 0:d8d41ed737a3 | 1 | #include "mbed.h" |
CCastrop1012 | 0:d8d41ed737a3 | 2 | |
CCastrop1012 | 0:d8d41ed737a3 | 3 | //------------------------------------ |
CCastrop1012 | 0:d8d41ed737a3 | 4 | // Hyperterminal configuration |
CCastrop1012 | 0:d8d41ed737a3 | 5 | // 9600 bauds, 8-bit data, no parity |
CCastrop1012 | 0:d8d41ed737a3 | 6 | //------------------------------------ |
CCastrop1012 | 0:d8d41ed737a3 | 7 | |
CCastrop1012 | 0:d8d41ed737a3 | 8 | Serial pc(SERIAL_TX, SERIAL_RX); |
CCastrop1012 | 0:d8d41ed737a3 | 9 | |
CCastrop1012 | 0:d8d41ed737a3 | 10 | DigitalOut myled(LED1); |
CCastrop1012 | 0:d8d41ed737a3 | 11 | |
CCastrop1012 | 0:d8d41ed737a3 | 12 | int main() |
CCastrop1012 | 0:d8d41ed737a3 | 13 | { |
CCastrop1012 | 0:d8d41ed737a3 | 14 | int i = 1; |
CCastrop1012 | 0:d8d41ed737a3 | 15 | pc.printf("Hello World !\n"); |
CCastrop1012 | 0:d8d41ed737a3 | 16 | while(1) { |
CCastrop1012 | 0:d8d41ed737a3 | 17 | wait(1); |
CCastrop1012 | 0:d8d41ed737a3 | 18 | pc.printf("This program runs since %d seconds.\n", i++); |
CCastrop1012 | 0:d8d41ed737a3 | 19 | myled = !myled; |
CCastrop1012 | 0:d8d41ed737a3 | 20 | } |
CCastrop1012 | 0:d8d41ed737a3 | 21 | } |