Check this one ! mbos setup changed, WTX hor pos changed, no font style check, no checksum check

Dependencies:   4DGL MODSERIAL mbed mbos

Fork of CDU_Mbed_21 by Engravity-CDU

Revision:
9:9a5f1b389973
Parent:
8:422544d24df3
Child:
10:7e350a27f936
--- a/keyboard2.cpp	Sun Jul 20 16:33:53 2014 +0000
+++ b/keyboard2.cpp	Sun Jul 20 17:55:46 2014 +0000
@@ -147,32 +147,39 @@
     //nVal 255     --> calculate brightness from potmeter value (default value if no parameter is passed)
     //nVal = 0     --> switch off backlight
     //nVal = 100   --> switch on backlight max
- 
+
+    static int LightOn = 1;
+
     switch (nVal) 
     {
         case 0:
         {
             //switch off backlighting
-            BGL_LED.pulsewidth( 0.0 );
+            BGL_LED = 0.0 ;
+            LightOn = 0;
             break;
         }
         case 100:
         {
             //switch on backlighting
-            BGL_LED.pulsewidth( 100.0 );
+            BGL_LED = BGL_POT;
+            LightOn = 1;
             break;
         }
         case 255:
         {
             //calculate percentage from potmeter value
-        if ( BGL_POT < 0.01 )
+            if ( LightOn == 1)
             {
-                BGL_LED = 0.0; //prevents flickering when low intensity
-            }
-        else
-            {
-                BGL_LED = BGL_POT; 
+                if ( BGL_POT < 0.01 )
+                    {
+                        BGL_LED = 0.0; //prevents flickering when low intensity
+                    }
+                else
+                    {
+                        BGL_LED = BGL_POT; 
+                    }
             }
         }
     }
-}          
+}    
\ No newline at end of file