Simple training demonstration to show the use of union
Fork of TypedefExample by
main.cpp
- Committer:
- jf1452
- Date:
- 2013-11-25
- Revision:
- 2:db81cad8cb64
- Parent:
- 1:d9da28105bef
- Child:
- 3:0f80147842c2
File content as of revision 2:db81cad8cb64:
/******************************************************************************* * This program demonstrates how to read a string from the USB serial device * * and write a string back to the USB serial device * * * * Jon Fuge * * V1.0 25/11/2013 First issue of code * *******************************************************************************/ #include "mbed.h" #include "USBSerial.h" //Virtual serial port over USB. Use Teraterm as the interface USBSerial serial; int main() { char buf[128]; // A char array is also a string! wait (10); // Wait 10 seconds to connect port // Need to type a key, then enter to get a response. serial.printf("What is your name?\n\r"); serial.scanf("%s", buf); serial.printf("What are you doing %s?\n\r", buf); for(;;) {} // Loop forever }