Istvan Cserny / Mbed 2 deprecated 06_frdm_uart2

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /** 06_frdm_uart2
00002  * Simple demo to demonstrate communication via UART2
00003  *
00004  * Hardware requirements:
00005  *  - FRDM-KL25Z board
00006  *  - USB-UART protocol converter (FTDI cable or similar)
00007  *
00008  *  Wiring: 
00009  *    FTDI RX to PTE22, FTDI TX to PTE23
00010  *    FTDI GND to GND, FTDI 5V to Vin
00011  */
00012 
00013 
00014 #include "mbed.h"
00015 
00016 DigitalOut myled(LED_GREEN);
00017 Serial pc(PTE22, PTE23);
00018 
00019 int main()
00020 {
00021     int i = 0;
00022     pc.printf("Hello World!\r\n");
00023 
00024     while (true) {
00025         wait_ms(1000);          // wait a small period of time
00026         i++;                    // increment the variable
00027         myled = !myled;         // toggle a led
00028         int s = myled;
00029         pc.printf("%d. ledstate = %d \r\n", i,s);  // print variable i and LED state        
00030     }
00031 }