Yoann Seiller / Mbed 2 deprecated Test_UART

Dependencies:   mbed

main.cpp

Committer:
dyooz
Date:
2021-10-02
Revision:
0:56723d925d39
Child:
1:e3bea6b4ce47

File content as of revision 0:56723d925d39:

/*-----------------------------------------------------------------------
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:

pc.baud(115200);
pc.printf("Hello World !\n");
-------------------------------------------------------------------------*/
#include "mbed.h"
Serial pc(PG_14,PG_9);        // Déclaration d’un objet de type Serial 



int main() { 
//char c ;      // Variable ou ranger un caractère 
int i=0;
  
pc.printf("\nTest liaison serie PC-Carte Nucleo\n"); 
pc.printf("Appuyer sur une touche du clavier \n"); 

while(1) { 
    wait(1);
    i++;
    printf("i = %d \n",i);
    pc.putc(i);
    if (i == 255){
        i=0;}
    
    }
}