![](/media/cache/profiles/a53d1388191884b75c48bebb18709bfb.50x50_q85.jpg)
Sample code to demonstrate PCA9955A's gradation control
Diff: main.cpp
- Revision:
- 5:33de84f8a660
- Parent:
- 2:0cc3bba73370
diff -r efcaf7b7e16f -r 33de84f8a660 main.cpp --- 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 );