This program exercises many of the peripherials including serial communication (prints bargraph on screen), as well as pushbutton (SW1 and SW2) and led red/blue usage. Based on Freescale program: frdm_helloworld, see http://developer.mbed.org/teams/Freescale/code/frdm_helloworld/?platform=FRDM-K64F REVISIONS: PC.BAUD = 115200-FAST, ADDED MSG STRINGS
Diff: main.cpp
- Revision:
- 2:4601839c95d1
- Parent:
- 1:5b588cbaccae
diff -r 5b588cbaccae -r 4601839c95d1 main.cpp --- a/main.cpp Sun Mar 22 21:16:41 2015 +0000 +++ b/main.cpp Mon Mar 23 03:50:12 2015 +0000 @@ -7,11 +7,16 @@ InterruptIn sw1(PTA4); Serial pc(USBTX, USBRX); //============================================================== +//ASCII CHARACTER FOR "WAIT 2 SECONDS" +char hello[]={87,65,73,84,32,50,32,83,69,67,79,78,68,83,}; +//-------------------------------------------------------------- +//ASCII CHARACTER FOR "TIME OUT" +char msg_1[]={84,32,73,32,77,32,69,32,32,79,32,85,32,84,}; //============================================================== char contador ; int temp_led; - //int i; + //-------------------------------------------------------------- //============================================================== void sw1_release(void) @@ -86,42 +91,24 @@ led_3 = 0; pc.printf("LED BLUE ON [TWO SECONDS]"); pc.printf("\n"); - - pc.printf("W"); - wait(2.0/40); - pc.printf("A"); - wait(2.0/40); - pc.printf("I"); - wait(2.0/40); - pc.printf("T"); - wait(2.0/40); - pc.printf(" "); - wait(2.0/40); - pc.printf("2"); - wait(2.0/40); - pc.printf(" "); - wait(2.0/4); - pc.printf("S"); - wait(2.0/43); - pc.printf("E"); - wait(2.0/43); - pc.printf("C"); - wait(2.0/43); - pc.printf("O"); - wait(2.0/43); - pc.printf("N"); - wait(2.0/43); - pc.printf("D"); - wait(2.0/43); - pc.printf("S"); - wait(2.0/43); - - for(char i=0 ; i<=25 ; i++) +//------------------------------------------------------------------ + + for(char i=0 ; i<=13 ; i++) { - pc.printf("."); - - wait(2.0/40); + wait(2.0/10); + pc.printf("%c",hello[i]); + wait(2.0/10); } +//------------------------------------------------------------------ + pc.printf("\n"); +//------------------------------------------------------------------ +for(char i=0 ; i<=13 ; i++) + { + wait(2.0/10); + pc.printf("%c",msg_1[i]); + wait(2.0/10); + } +//------------------------------------------------------------------ pc.printf("\n"); pc.printf("===========================================\n");