//Simple program allowing user to recieve string from STM32F4 and output it through com port

Dependencies:   mbed

Fork of FRDM-K64F-UARTCOMMS by Demo Team

Committer:
andcor02
Date:
Wed Mar 04 15:11:46 2015 +0000
Revision:
1:e1492422d835
Parent:
0:f682dcf80f00
//Simple program allowing user to receive string from STM32F4 and output it through com port

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andcor02 0:f682dcf80f00 1 #include "mbed.h"
andcor02 1:e1492422d835 2 //Simple program allowing user to recieve string from STM32F4 and output it through com port
andcor02 0:f682dcf80f00 3 //Andrea Corrado
andcor02 0:f682dcf80f00 4 Serial pc(USBTX, USBRX); // tx, rx
andcor02 0:f682dcf80f00 5 Serial uart (PTC17, PTC16);
andcor02 1:e1492422d835 6 char strn [17];
andcor02 1:e1492422d835 7 char c;
andcor02 0:f682dcf80f00 8
andcor02 0:f682dcf80f00 9 int main()
andcor02 0:f682dcf80f00 10 {
andcor02 0:f682dcf80f00 11 while(1) {
andcor02 1:e1492422d835 12 // if (pc.readable()) {
andcor02 1:e1492422d835 13 // uart.putc(pc.getc()); //trans
andcor02 1:e1492422d835 14 // }
andcor02 1:e1492422d835 15 if (uart.readable()) {
andcor02 1:e1492422d835 16 uart.gets(strn, 17);
andcor02 1:e1492422d835 17 pc.printf ("\n\r%s", strn);
andcor02 0:f682dcf80f00 18 }
andcor02 0:f682dcf80f00 19 }
andcor02 0:f682dcf80f00 20 }