now when you turn the draaiknop the lampje will dim

Dependencies:   MODSERIAL mbed

Files at this revision

API Documentation at this revision

Comitter:
charloverwijk
Date:
Thu Sep 21 09:56:08 2017 +0000
Branch:
knopjes
Parent:
1:c6776cafbfd9
Commit message:
project draaiknop;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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;
     }
 }