From eb68b98cf517f0d1ed53a6567a4f3d2df4b1a5dd Mon Sep 17 00:00:00 2001 From: Ralf Schlatterbeck Date: Fri, 8 Dec 2017 20:34:51 +0100 Subject: [PATCH] Also output smooth led on pin 3 --- examples/osd/arduino-led/sketch.pde | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/osd/arduino-led/sketch.pde b/examples/osd/arduino-led/sketch.pde index e3281faf9..6c2b810d4 100644 --- a/examples/osd/arduino-led/sketch.pde +++ b/examples/osd/arduino-led/sketch.pde @@ -16,6 +16,7 @@ extern "C" { #include "led_setting.h" #define TIMER 3 #define PIN_PWM_C 4 +#define PIN_PWM_B 3 static uint16_t pwm_max = 0; } @@ -25,8 +26,11 @@ void setup (void) hwtimer_ini (3, HWT_WGM_PWM_PHASE_8_BIT, HWT_CLOCK_PRESCALER_8, 0); //hwtimer_pwm_ini (TIMER, 1000, HWT_PWM_FAST, 0); hwtimer_pwm_enable (TIMER, HWT_CHANNEL_C); + hwtimer_pwm_enable (TIMER, HWT_CHANNEL_B); hwtimer_set_pwm (TIMER, HWT_CHANNEL_C, 0); + hwtimer_set_pwm (TIMER, HWT_CHANNEL_B, 255); pinMode (PIN_PWM_C, OUTPUT); + pinMode (PIN_PWM_B, OUTPUT); pwm_max = hwtimer_pwm_max_ticks (TIMER); printf ("pwm_max: %u\n", pwm_max); } @@ -36,6 +40,7 @@ void loop (void) static int direction = 1; static unsigned const char *led_ptr = led_setting; hwtimer_set_pwm (TIMER, HWT_CHANNEL_C, *led_ptr); + hwtimer_set_pwm (TIMER, HWT_CHANNEL_B, 255 - *led_ptr); //printf ("p: %u\n", *led_ptr); if (led_ptr >= led_setting + sizeof (led_setting) - 1 && direction > 0) { direction = -1;