Example program to work with serial console.
Dependencies: mbed
main.cpp
- Committer:
- smigielski
- Date:
- 2014-11-20
- Revision:
- 1:3facaa34f110
- Parent:
- 0:6e7311915b08
File content as of revision 1:3facaa34f110:
#include "mbed.h" #define BAUD_RATE 9600 //default baud rate //#define BAUD_RATE 115200 //#define BAUD_RATE 230400 //#define BAUD_RATE 460800 //does not work right now //#define BAUD_RATE 921600 //does not work right now //as of https://developer.mbed.org/forum/mbed/topic/893/?page=1#comment-4526 //the list of supported baud rates is //110, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 38400, 57600, 115200, 230400, 460800, 921600 char name[256] = {0}; int main() { //Configure boud rate Serial s(USBTX, USBRX); //default for nrf51 is p0.09 p0.11 s.baud(BAUD_RATE); while(1) { printf("Hi!\r\n"); printf("What is your name (input name and hit enter)?\r\n"); scanf( "%s" , name ); printf("Hi %s!\r\n",name); printf("It was nice to meet you!\r\n\r\n\r\n\r\n"); } }