Enrico Marinoni / Mbed 2 deprecated NucleoL152RE_and_USART2

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 
00002 // Bye www.emcu.it
00003 // Tested on NUCLEO_L152RE
00004 // for more info see here: http://www.emcu.it/NUCLEOevaBoards/U2andL152/U2andL152.html#How_to_use_USART2
00005 //
00006 // This program send a character via USART2 and via USB (Virtual Com)
00007 // USART2 is connected to STLINK that send data via USB.
00008 // ATTENTION:
00009 // For connect USART2 to D1/TX and D0/RX it is necessary do a bridge on SB63 and SB62 that are on the rear of NUCLEO_L152RE board.
00010 // I suggest to use TeraTerm to connect the NUCLEO via CN1 (USB)
00011 // Configure TeraTerm with these parameters:
00012 // Baud: 9600 - Data: 8bit - Parity: None - Stop: 1bit - Flow Control: None
00013 
00014 #include "mbed.h"
00015  
00016 Serial pc(SERIAL_TX, SERIAL_RX);    // tx, rx USB Virtual COM
00017 
00018 
00019 int main() {
00020     while(1) {
00021       
00022         if(pc.readable()) {
00023             pc.putc(pc.getc());
00024         }
00025        
00026         wait(0.1);
00027         pc.printf("E");
00028 
00029     }
00030 }