Template for the ELEC1620 End of year exam

Dependencies:   mbed

Revision:
0:54721f063ac8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/exam.cpp	Fri Mar 22 13:11:07 2019 +0000
@@ -0,0 +1,128 @@
+#include "exam.h"
+
+// Task 1
+// 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()){
+
+  }
+}
+
+// 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()){
+
+  }
+}
+
+// Task 3
+// Blue LED is the XOR of A and B
+// (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()){
+
+  }
+}
+
+// Task 4
+// Print the temperature measured with the temperature sensor as an integer over serial (using the following formula: 100 V - 50
+// Print every value in a new line
+// (3 marks)
+void Task4(TestAdmin &tester, AnalogIn &temp){
+
+  while(tester.testRunning()){
+
+  }
+}
+
+// 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()){
+
+  }
+}
+
+// Task 6
+// Pot0 -> Red, Pot1 -> Green, Pot2 -> Blue: use the potentiometers to set the brightness of each LED
+// 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()){
+
+  }
+}
+
+
+// Task 7
+// 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()){
+
+  }
+}
+
+// Task 8
+// Display the following pattern on repeat on the LEDs with a 0.5s delay
+// 0: | O |   |   |   |
+// 1: |   | O |   |   |
+// 2: |   |   | O |   |
+// 3: |   |   |   | O |
+// 4: |   |   | O |   |
+// 5: |   | O |   |   |
+// (4 marks)
+void Task8(TestAdmin &tester, BusOut &leds){
+
+  while(tester.testRunning()){
+
+  }
+}
+
+
+// Task 9
+// Display the following pattern on the seven segmented display
+//
+//    |   |
+//    |___|
+//    |   |
+//    |   |
+// (4 marks)
+void Task9(TestAdmin &tester, ShiftReg &shift){
+
+  while(tester.testRunning()){
+
+  }
+}
+
+// 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()){
+
+  }
+}
+
+// Task 11
+// Count up 0->9 on the seven segmented display when A pressed and down when B pressed
+// (cycle around from 0 to 9 and 9 to 0)
+// (5 marks)
+void Task11(TestAdmin &tester, ShiftReg &shift, DigitalIn &button_a, DigitalIn &button_b){
+
+  while(tester.testRunning()){
+
+  }
+}