Simple training demonstration to show the use of union
Fork of TypedefExample by
main.cpp
- Committer:
- jf1452
- Date:
- 2013-11-26
- Revision:
- 4:c4e451a1890f
- Parent:
- 3:0f80147842c2
- Child:
- 5:eb5c6ae5938b
File content as of revision 4:c4e451a1890f:
/******************************************************************************* * This program demonstrates the use of enumeration * * * * Jon Fuge * * V1.0 25/11/2013 First issue of code * *******************************************************************************/ #include "mbed.h" #include "USBSerial.h" enum DaysOfTheWeek { SUN , MON, TUE, WED, THUR, FRI, SAT }; enum MonthsOfTheYear { JAN = 1, FEB, MAR, APR, MAY, JUN,\ JUL, AUG, SEP, OCT, NOV, DEC}; USBSerial serial; // Virtual serial port over USB. Use Teraterm as the interface int main() { wait (10); // Wait 10 seconds to connect port serial.printf("Sunday is day %i, April is the %i month of the year\n\r", SUN, APR); for(;;) {} // Loop forever }