s

Dependencies:   mbed

Fork of LAB07_Oppgave4_Template by EN-SOC3001

Files at this revision

API Documentation at this revision

Comitter:
Voldread
Date:
Thu Oct 15 15:01:49 2015 +0000
Parent:
0:ce0d1043321f
Commit message:
S

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r ce0d1043321f -r 3313c84ab6d7 main.cpp
--- a/main.cpp	Wed Oct 14 19:06:20 2015 +0000
+++ b/main.cpp	Thu Oct 15 15:01:49 2015 +0000
@@ -1,8 +1,10 @@
 #include "mbed.h"
 
+Ticker led_ticker;
 Timeout    onTime;
 Ticker     periodTimer;
 DigitalOut led(PA_9); 
+InterruptIn SW6(PA_10), SW7(PB_3);
 
 float periodTime=0.020;  // 20ms period time (50Hz)
 float dutyCycle=.05;
@@ -16,9 +18,21 @@
     onTime.attach(&TurnLightOff,(float)periodTime*dutyCycle);
 }
 
+void SW7Trykket()
+{   dutyCycle=dutyCycle+.1f;
+    //led_ticker.attach(&led, dutyCycle);
+}    
+ void SW6Trykket()
+{   dutyCycle=dutyCycle-.1f;
+    //led_ticker.attach(&led, dutyCycle);
+}
+
 int main()
 {
+    if (dutyCycle>0);
     periodTimer.attach(&TurnLightOn,periodTime);
+    SW7.fall(&SW7Trykket);
+    SW6.fall(&SW6Trykket);
 
     while(1) {
         wait(1);