ff snel plz

Dependencies:   FastPWM MODSERIAL mbed

Fork of Week3_Assignment1 by Eva Krolis

Revision:
3:f9ac37cdfa50
Parent:
2:4b07b20b8476
--- a/main.cpp	Fri Sep 21 10:22:20 2018 +0000
+++ b/main.cpp	Fri Sep 21 11:51:47 2018 +0000
@@ -5,23 +5,25 @@
 int frequency_pwm = 10000;
 InterruptIn button1(D1);
 InterruptIn button2(D2);
+float b; //float moet hier al gedefinieerd zijn
 
-void brightness()
-{
-    if (button1 == 1)
-    {
-        led1.write(1);
+void fel(){
+    if(button1 == 1){ //Hier maak ik een interrupt voor meer felheid
+        b = b + 0.1;  //In stapjes van 0.1
+        led1.write(b);
     }
 }
-
+void dim(){
+    if(button2 == 1){  //Interrupt voor minder felheid (dimmen)
+        b = b - 0.1;
+        led1.write(b);
+    }
+}
 int main()
 {
     led1.period(1.0/frequency_pwm);
-    //button1.rise(brightness);
+    button1.rise(&fel);  //Interrupt koppelen
+    button2.rise(&dim);
+    while(true){}
     
-    while (true) 
-    {
-            led1.write(0.01);
-            button1.rise(brightness);
-    }
 }
\ No newline at end of file