kl46z_slider_Counter_Program_v1_Dorian_Folie_v1
Fork of kl46z_slider_mid_v1 by
Revision 3:9295f3b7c389, committed 2016-11-07
- Comitter:
- dorian505
- Date:
- Mon Nov 07 04:53:00 2016 +0000
- Parent:
- 2:1a52668f84e5
- Commit message:
- kl46z_slider_Counter_Program_v2_Dorian_Folie
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Nov 07 00:44:45 2016 +0000 +++ b/main.cpp Mon Nov 07 04:53:00 2016 +0000 @@ -25,21 +25,32 @@ DigitalIn buttons[NUMBUTS] = {RBUT, LBUT}; int displayState = ARGUMENTSTATE; float tsidata; -//int displayState; +float lcdArgument; float countOut; -float AbsoluteDistancePosition; - -float delta=2; -float min_num=2; -float max_num=50; + +//while {(AbsoluteDistancePosition>=min_num) && (AbsoluteDistancePosition<=max_num) +// backward_count()=AbsoluteDistancePosition-delta; +// } + +float backward_count(lcdArgument): + lcdArgument = 0; + float delta=2; + float min_num=2; + float max_num=50; + + if (n <= min_num) && (n >= max_num){ + return + else: + return backward_count(n-delta, delta, min_num) + pc.printf("%5.4f", backward_count) + } -float backward_count(AbsoluteDistancePosition) - -if {(AbsoluteDistancePosition>=min_num) && (AbsoluteDistancePosition<=max_num) - backward_count()=AbsoluteDistancePosition-delta; - } - pc.printf("%5.4f", AbsoluteDistancePosition) - +def main(): + number = 25 + increment = 2 + min_number = -5 + backward_count(number,increment, min_number) + void initialize_global_vars(){ pc.printf(PROGNAME); @@ -50,7 +61,7 @@ dataTimer.reset(); } -void LCDMess(char *lMess) +void LCDMess(char *lMess){ slcd.Home(); slcd.clear(); slcd.printf(lMess); @@ -77,12 +88,26 @@ } // if ! buttons }// for loop to look at buttons ButtonTimer.reset(); - sprintf (lcdData,"%0.4f",tsidata); - LCDMess(lcdData); - rled = 0.0; - gled = 1.0; - - } + swtich (displayState){ + case ARGUMENTSTATE : { + lcdArgument = tsidata * 100; + sprintf (lcdData, "%4.1f", lcdArgument); + LCDMess(lcdData); + rled = 0.0; + gled = 1.0; + break; + } + case ANSWERSTATE : { + countOut = backward_Count(lcdArguemnt) + sprintf (lcdData,"%0.4f", countOut); + LCDMess(lcdData); + rled = 0.0; + gled = 1.0; + break; + } + } + } + if(dataTimer.read() > DATAINTERVAL){ dataTimer.reset(); tempTSI = tsi.readPercentage();