Test application for the STMicroelectronics X-NUCLEO-LED61A1 LED Control Expansion Board showing several LED control modes, built against mbed OS.
Dependencies: X_NUCLEO_LED61A1
Fork of LedDimming_LED61A1 by
LED Control with the X-NUCLEO-LED61A1 Expansion Board
This application provides an example of usage of the X-NUCLEO-LED61A1 LED Control Expansion Board. It shows how to control a LED stripe load connected to the board through the following control modes:
- Manual PWM Dimming;
- Manual Analog Dimming;
- Sinusoidal PWM Dimming;
- Sinusoidal Analog Dimming;
- Photo-based Analog Dimming.
The button of the MCU board, when available, can be used in the following ways:
- Short Button Press [<0.5s] for Manual Dimming;
- Medium Button Press to Switch Demo;
- Long Button Press [>2s] to Switch Power ON/OFF.
The program starts in mode 1.
Revision 7:5763474c7551, committed 2016-02-04
- Comitter:
- Davidroid
- Date:
- Thu Feb 04 10:28:09 2016 +0000
- Parent:
- 6:899828fd9d9d
- Child:
- 8:6d8bc71c6d4f
- Commit message:
- Bug fixing (sinusoidal wave).
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Jan 15 17:12:03 2016 +0000
+++ b/main.cpp Thu Feb 04 10:28:09 2016 +0000
@@ -3,9 +3,9 @@
* @file main.cpp
* @author Davide Aliprandi, STMicroelectronics
* @version V1.0.0
- * @date December 9th, 2015
+ * @date February 4h, 2016
* @brief mbed test application for the STMicroelectronics X-NUCLEO-LED61A1
- * LED expansion board.
+ * LED Control Expansion Board showing several LED control modes.
******************************************************************************
* @attention
*
@@ -236,14 +236,14 @@
/* Changing PWM dimming continuously. */
case AUTOMATIC_PWM_DIMMING:
pwm_dimming = 0.5f * sin(2 * M_PI * (tick++ * LOOP_PERIOD_us) / PWM_SIN_PERIOD_us) + 0.5f;
- tick %= (int) (PWM_SIN_PERIOD_us / LOOP_PERIOD_us) + 1;
+ tick %= (int) (PWM_SIN_PERIOD_us / LOOP_PERIOD_us);
action = SWITCH_STATE;
break;
/* Changing Analog dimming continuously. */
case AUTOMATIC_ANALOG_DIMMING:
analog_dimming = 0.5f * sin(2 * M_PI * (tick++ * LOOP_PERIOD_us) / ANALOG_SIN_PERIOD_us) + 0.5f;
- tick %= (int) (ANALOG_SIN_PERIOD_us / LOOP_PERIOD_us) + 1;
+ tick %= (int) (ANALOG_SIN_PERIOD_us / LOOP_PERIOD_us);
action = SWITCH_STATE;
break;
@@ -367,7 +367,7 @@
"Demos:\r\n");
int demo = 0;
for (demo = 0; demo < LED_DEMO_SIZE; demo++)
- printf("%d) %-26s\r\n", demo, demos[demo]);
+ printf("%d) %-26s\r\n", demo + 1, demos[demo]);
printf("\r\nActions:\r\n" \
"+ Short Button Press [<%.1fs] --> Manual Dimming\r\n" \
"+ Medium Button Press --> Switch Demo\r\n" \
