Library for ELEC2645 Gamepad PCB. University of Leeds Version 2 January 2020

Dependents:   ELEC2645_Ticker_WAV ELEC2645_Project_username ELEC2645_Project_el18vgt ELEC2645_Project_el17oc11 ... more

Revision:
18:e0a4f15a7750
Parent:
17:cf1e1ffcf773
Child:
21:da0b4e14c867
--- a/Gamepad.cpp	Sun Mar 05 19:01:31 2017 +0000
+++ b/Gamepad.cpp	Sun Mar 05 19:28:14 2017 +0000
@@ -90,8 +90,16 @@
     _led6->write(val);
 }
 
-void Gamepad::led(int n,float val)
+void Gamepad::led(int n,float val) const
 {
+    // ensure they are within vlaid range
+    if (val < 0.0f) {
+        val = 0.0f;
+    }
+    if (val > 1.0f) {
+        val = 1.0f;
+    }
+    
     switch (n) {
         
         // check for valid LED number and set value