Franck DURAND / Mbed 2 deprecated Test_UART_Nucleo_F429ZI

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
pierreprovent
Date:
Wed Sep 16 13:15:42 2020 +0000
Parent:
0:918fdb31e2ce
Commit message:
Fichier source pour cours ELE118 Cnam

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Sep 15 11:24:56 2020 +0000
+++ b/main.cpp	Wed Sep 16 13:15:42 2020 +0000
@@ -1,12 +1,32 @@
 #include "mbed.h"
 
-DigitalOut myled(LED1);
+/*-----------------------------------------------------------------------
+Before to use this example, ensure that you an hyperterminal installed on your computer. 
+More info here: https://developer.mbed.org/handbook/Terminals
+The default serial comm port uses the SERIAL_TX and SERIAL_RX pins (see their definition in the PinNames.h file).
+The default serial configuration in this case is 9600 bauds, 8-bit data, no parity. 
+If you want to change the baudrate for example, you have to redeclare the
+serial object in your code:
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+
+Then, you can modify the baudrate and print like this:
 
-int main() {
+pc.baud(115200);
+pc.printf("Hello World !\n");
+-------------------------------------------------------------------------*/
+
+DigitalOut led(LED1);
+
+int main()
+{
+    int i = 1;
+
+    printf("Hello World !\n");
+
     while(1) {
-        myled = 1; // LED is ON
-        wait(0.2); // 200 ms
-        myled = 0; // LED is OFF
-        wait(1.0); // 1 sec
+        wait(1); // 1 second
+        led = !led; // Toggle LED
+        printf("This program runs since %d seconds.\n", i++);
     }
 }