![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
now when you turn the draaiknop the lampje will dim
Diff: main.cpp
- Branch:
- knopjes
- Revision:
- 2:aca5a168a6d3
- Parent:
- 1:c6776cafbfd9
--- a/main.cpp Tue Sep 19 14:34:47 2017 +0000 +++ b/main.cpp Thu Sep 21 09:56:08 2017 +0000 @@ -8,25 +8,24 @@ PwmOut led2(D6); PwmOut led1(D5); -int a=5000; -float PwmPeriod= 1/a; +int a=1; int main() { while (true) { - if (But1==true) + if (But1==false) { - a=a+100; + a=a+0.1; } - else if (But2==true) + else if (But2==false) { - a=a-100; + a=a-0.1; } else {} wait(0.1f); - led1.period(PwmPeriod); + led2=a; } }