8 years, 10 months ago.

RGB LED blink with PWM objects is not working FRDM-K64F using mbed compiler

Hi,

I have compiled the following program and downloaded to FRDM-K64F. I do not see RGB LED blinking. I used the same program for FRDM-KL25Z it works correctly.

Can some one look into this issue ?

  1. include "mbed.h"

PwmOut r (LED_RED); PwmOut g (LED_GREEN); PwmOut b (LED_BLUE);

int main() { r.period(0.001); g.period(0.001); b.period(0.001);

while (true) { for (float i = 0.0; i < 1.0 ; i += 0.001) { float p = 3 * i; r = 1.0 - ((p < 1.0) ? 1.0 - p : (p > 2.0) ? p - 2.0 : 0.0); g = 1.0 - ((p < 1.0) ? p : (p > 2.0) ? 0.0 : 2.0 - p); b = 1.0 - ((p < 1.0) ? 0.0 : (p > 2.0) ? 3.0 - p : p - 1.0); wait (0.0025); } } }

Question relating to:

The Freedom-K64F is an ultra-low-cost development platform for Kinetis K64, K63, and K24 MCUs.

Looks like PWM pins are not connected to RGB LED on K64F. This is the reason for RGB LED not blinking.

posted by Jags K 24 Jun 2015

1 Answer

8 years, 10 months ago.

If you look carefully at the pin out diagram you will notice that the pins driving the RGB led on the K64F are not PWM enabled but are on the KL25Z, which explains why it works on the KL25Z and not the K64F.

Accepted Answer