Jim Spruell / Mbed 2 deprecated inttest
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 DigitalOut LED(LED_RED);   // PTD1?
00004 
00005 
00006 //  help!!!!!!!!!!!!!!!!!!1
00007 /*
00008 program works fine whith the InterruptIN Event(PTA2);  COMMENTED OUT
00009 
00010 WITH THIS STATEMENT IN ALL THE printf's quit working, the LE still flashes every 2 seconds
00011 
00012 I am unsing with a Freescale FRDM-KL25Z CARD
00013 
00014 please email suggestions to make work  to jimspruell@comcast.net 
00015 
00016 */
00017 
00018 
00019 //InterruptIn EVENT(PTA2);  //J1-PIN4, INT PORT A OR D ONLY)
00020 DigitalOut FLOW_P(PTD4);  //J1-PIN6  tied to pin4 
00021 
00022 int flow_counter,pass;    
00023 
00024 void trigger()
00025 {
00026 // interrupt flag clear?
00027     flow_counter++;
00028     printf( "flow_counter=%d \r\n", flow_counter );
00029 // return from interrupt?
00030 }
00031 
00032 int main()
00033 {
00034 
00035     FLOW_P=0;            // pulse down
00036 //    EVENT.mode(PullUp);
00037     pass = 0;
00038     flow_counter = 0;      // flow
00039   
00040     printf("before event.rise() \r\n");
00041 //    EVENT.rise(&trigger);
00042     printf("after event.rise() \r\n");    
00043     LED=1;  
00044     while(1)
00045      {
00046         LED = ! LED;
00047         pass++;
00048         FLOW_P = ! FLOW_P;
00049         printf("pass = %d  flow_count=%d \r\n",pass,flow_counter);
00050         wait(2.0f);
00051      }
00052  
00053   
00054 } // END OF MAIN