![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Embedded software Assessment 2
Dependencies: MCP23017 SDFileSystem USBDevice WattBob_TextLCD mbed
Diff: main.cpp
- Revision:
- 17:dba09fb3f508
- Parent:
- 16:0a2138a18f26
- Child:
- 18:f485d46a7acb
diff -r 0a2138a18f26 -r dba09fb3f508 main.cpp --- a/main.cpp Wed Feb 26 22:09:17 2014 +0000 +++ b/main.cpp Fri Feb 28 10:29:29 2014 +0000 @@ -18,20 +18,22 @@ Init_LCD(); InitFile(); LogTimer.start(); - //Call the CycleFunction every 100 msec + //Call the CycleFunction every 100 msec can see that on pin30 Cycle.attach(&CycleFunction,0.1); } void CycleFunction(){ TickerPin=!(TickerPin); Counter++; - if((float(Counter/4.0)-Counter/4)==0) ReadDigitalin(); - if((float(Counter/8.0)-Counter/8)==0) ReadAnalogin(); - if((float(Counter/10.0)-Counter/10)==0) FreqMsur(); - if((float(Counter/15.0)-Counter/15)==0) BinaryCounter(); - if((float(Counter/18.0)-Counter/18)==0) InputCheck(); - if((float(Counter/20.0)-Counter/20)==0) Display(); - if((float(Counter/50.0)-Counter/50)==0) LogFile(); + //Can see the period of execute every function below on the pin that + //writen infront of it + if((float(Counter/4.0)-Counter/4)==0) ReadDigitalin(); //Pin 21 + if((float(Counter/8.0)-Counter/8)==0) ReadAnalogin(); //Pin 22 + if((float(Counter/10.0)-Counter/10)==0) FreqMsur(); //Pin 23 + if((float(Counter/15.0)-Counter/15)==0) BinaryCounter();//Pin 24 + if((float(Counter/18.0)-Counter/18)==0) InputCheck(); //Pin 25 + if((float(Counter/20.0)-Counter/20)==0) Display(); //Pin 26 + if((float(Counter/50.0)-Counter/50)==0) LogFile(); //Pin 27 //The least common multiple for all the above is 1800 cycles // so every 180 Sec all the functions are repeated if(Counter==1800) Counter=0;