Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
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 ?
- 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:
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.
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