![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Test script for PwmOut control LED with buttons
Revision 1:9654405c52f4, committed 2018-09-28
- Comitter:
- rubenlucas
- Date:
- Fri Sep 28 07:22:53 2018 +0000
- Parent:
- 0:2ba57c4723ea
- Commit message:
- if statements not equal to 1.0 and 0.0 but just a bit below. rounding error prevention
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Sep 26 12:35:57 2018 +0000 +++ b/main.cpp Fri Sep 28 07:22:53 2018 +0000 @@ -11,7 +11,7 @@ void BrighterFcn() { - if (DutyCycle == 1.0) // check if duty cycle is already at max + if (DutyCycle >= 0.9) // check if duty cycle is already at max {return;} else {DutyCycle = DutyCycle + 0.025;} // raise duty cycle with 2.5% @@ -19,7 +19,7 @@ void DimmerFcn() { - if (DutyCycle == 0.0) // check if duty cycle is already at minimum + if (DutyCycle <= 0.1) // check if duty cycle is already at minimum {return;} else {DutyCycle = DutyCycle - 0.025;} // lower duty cycle with 2.5%