ELEC1620 / Mbed 2 deprecated ELEC1620_ExamTemplate_2019

Dependencies:   mbed

Revision:
2:f56d6bd8aa25
Parent:
1:a77034716cad
Child:
3:9fd187c3fd38
--- a/exam.cpp	Tue Mar 26 11:32:03 2019 +0000
+++ b/exam.cpp	Tue Mar 26 18:06:06 2019 +0000
@@ -4,20 +4,24 @@
 // Hold A to turn the Red LED on. Let go to turn off
 // (3 marks)
 void Task1(TestAdmin &tester, PwmOut &r_led, DigitalIn &button_a){
-
-  while(tester.testRunning()){
-
-  }
+    // Code here that executed at the start of the task
+  
+    while(tester.testRunning()){    // Run untill button D is pressed
+        // Code here that executed continously during the task
+    
+    }
 }
 
 // Task 2
 // A - > Red, B -> Green, C -> Blue: Hold to turn on, release to turn off
 // (3 marks)
 void Task2(TestAdmin &tester, PwmOut &r_led, PwmOut &g_led, PwmOut &b_led, DigitalIn &button_a, DigitalIn &button_b, DigitalIn &button_c){
-
-  while(tester.testRunning()){
-
-  }
+    // Code here that executed at the start of the task
+  
+    while(tester.testRunning()){    // Run untill button D is pressed
+        // Code here that executed continously during the task
+    
+    }
 }
 
 // Task 3
@@ -25,10 +29,12 @@
 // (i.e. LED is on only when either of the buttons are pressed but not if both)
 // (3 marks)
 void Task3(TestAdmin &tester, PwmOut &b_led, DigitalIn &button_a, DigitalIn &button_b){
-
-  while(tester.testRunning()){
-
-  }
+    // Code here that executed at the start of the task
+  
+    while(tester.testRunning()){    // Run untill button D is pressed
+        // Code here that executed continously during the task
+    
+    }
 }
 
 // Task 4
@@ -36,20 +42,24 @@
 // Print every value in a new line
 // (3 marks)
 void Task4(TestAdmin &tester, AnalogIn &temp){
-
-  while(tester.testRunning()){
-
-  }
+    // Code here that executed at the start of the task
+  
+    while(tester.testRunning()){    // Run untill button D is pressed
+        // Code here that executed continously during the task
+    
+    }
 }
 
 // Task 5
 // Green LED if the LDR can see light, Red LED if the LDR is covered
 // (3 marks)
 void Task5(TestAdmin &tester, PwmOut &r_led, PwmOut &g_led, AnalogIn &ldr){
-
-  while(tester.testRunning()){
-
-  }
+    // Code here that executed at the start of the task
+  
+    while(tester.testRunning()){    // Run untill button D is pressed
+        // Code here that executed continously during the task
+    
+    }
 }
 
 // Task 6
@@ -57,10 +67,12 @@
 // between fully off (when turned all the way to the left) and fully on (when turned all the way to the right)
 // (3 marks)
 void Task6(TestAdmin &tester, PwmOut &r_led, PwmOut &g_led, PwmOut &b_led, AnalogIn &pot_0, AnalogIn &pot_1, AnalogIn &pot_2){
-
-  while(tester.testRunning()){
-
-  }
+    // Code here that executed at the start of the task
+  
+    while(tester.testRunning()){    // Run untill button D is pressed
+        // Code here that executed continously during the task
+    
+    }
 }
 
 
@@ -68,10 +80,12 @@
 // Toggle the Red LED i.e. Press A to turn on, press again to turn off
 // (4 marks)
 void Task7(TestAdmin &tester, PwmOut &r_led, DigitalIn &button_a){
-
-  while(tester.testRunning()){
-
-  }
+    // Code here that executed at the start of the task
+  
+    while(tester.testRunning()){    // Run untill button D is pressed
+        // Code here that executed continously during the task
+    
+    }
 }
 
 // Task 8
@@ -84,10 +98,12 @@
 // 5: |   | O |   |   |
 // (4 marks)
 void Task8(TestAdmin &tester, BusOut &leds){
-
-  while(tester.testRunning()){
-
-  }
+    // Code here that executed at the start of the task
+  
+    while(tester.testRunning()){    // Run untill button D is pressed
+        // Code here that executed continously during the task
+    
+    }
 }
 
 
@@ -100,18 +116,22 @@
 //    |   |
 // (4 marks)
 void Task9(TestAdmin &tester, ShiftReg &shift){
-
-  while(tester.testRunning()){
-
-  }
+    // Code here that executed at the start of the task
+  
+    while(tester.testRunning()){    // Run untill button D is pressed
+        // Code here that executed continously during the task
+    
+    }
 }
 
 // Task 10
 // Use the joystick to set the following patterns on the seven segmented display
 // (5 marks)
 void Task10(TestAdmin &tester, ShiftReg &shift, AnalogIn &joy_v, AnalogIn &joy_h){
-
-  while(tester.testRunning()){
-
-  }
+    // Code here that executed at the start of the task
+  
+    while(tester.testRunning()){    // Run untill button D is pressed
+        // Code here that executed continously during the task
+    
+    }
 }