Sample code to demonstrate PCA9955A's gradation control

Dependencies:   mbed PCA995xA

Components / PCA9955B, PCA9956B : 16 & 24-channel constant current LED driver
PCA9955B and PCA9956B are I²C-bus controlled 16-channel constant current LED driver optimized for dimming and blinking.

Files at this revision

API Documentation at this revision

Comitter:
nxp_ip
Date:
Fri Jun 17 06:09:24 2022 +0000
Parent:
4:efcaf7b7e16f
Commit message:
Made gradation period shorter

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Jun 16 23:21:52 2022 +0000
+++ b/main.cpp	Fri Jun 17 06:09:24 2022 +0000
@@ -3,7 +3,7 @@
 #include "PCA9955A.h"
 PCA9955A    led_cntlr( p28, p27, 0x02 );    //  SDA, SCL, Slave_address(option)
 
-#define GRADATION_PERIOD            6.0
+#define GRADATION_PERIOD            2.8
 
 #define MANUAL_BLINK_PERIOD         0.1
 #define MANUAL_BLINK_ON_DURATION    0.03
@@ -32,9 +32,11 @@
     //  Making same gradation shape to group 0, 1 and 2
     //  The gradation shape will be total 6 seconds cycle including 2 seconds LED-OFF
     float cycle   =
-    led_cntlr.gradation_ramp_setting( 0, GRADATION_PERIOD, HOLD_0_00_SEC, HOLD_2_00_SEC, RAMP_UP_DOWN );
-    led_cntlr.gradation_ramp_setting( 1, GRADATION_PERIOD, HOLD_0_00_SEC, HOLD_2_00_SEC, RAMP_UP_DOWN );
-    led_cntlr.gradation_ramp_setting( 2, GRADATION_PERIOD, HOLD_0_00_SEC, HOLD_2_00_SEC, RAMP_UP_DOWN );
+    led_cntlr.gradation_ramp_setting( 0, GRADATION_PERIOD, HOLD_0_00_SEC, HOLD_0_75_SEC, RAMP_UP_DOWN );
+    led_cntlr.gradation_ramp_setting( 1, GRADATION_PERIOD, HOLD_0_00_SEC, HOLD_0_75_SEC, RAMP_UP_DOWN );
+    led_cntlr.gradation_ramp_setting( 2, GRADATION_PERIOD, HOLD_0_00_SEC, HOLD_0_75_SEC, RAMP_UP_DOWN );
+
+    //  printf( "cycle = %f\r\n", cycle );
 
     //  Start group 0
     led_cntlr.gradation_start( 0 );