11 years, 7 months ago.

PWM BUG?

Hello,

is there a bug with PWM??

Connect to your mbed Microcontroller with a Terminal program and uses the 'u' and 'd' keys to make LED1 brighter or dimmer

  1. include "mbed.h"

Serial pc(USBTX, USBRX); tx, rx PwmOut led(LED1);

float brightness = 0.0;

int main() { pc.printf("Press 'u' to turn LED1 brightness up, 'd' to turn it down\n");

while(1) { char c = pc.getc(); if((c == 'u') && (brightness < 0.5)) { brightness += 0.01; led = brightness; } if((c == 'd') && (brightness > 0.0)) { brightness -= 0.01; led = brightness; }

} }

The syntax is correct but on my terminal i get the message "pinmap not found for peripheral" and the 4 LEDs toggel... NO PWM.

Whats the Problem here?

Thank you

Question relating to:

2 Answers

Jovica D.
poster
11 years, 7 months ago.

no bug :S the controller doesn't have PWM

11 years, 7 months ago.

Hi, are you sure the LPC11U24 has no PWM? It looks like there are several pins for PWM, but NOT the LEDs: http://mbed.org/handbook/PwmOut#lpc11u24

Hey David,

i search in the Dokumentation of LPC11U24, this controller doesn't have PWM... but i'm not realy shure. In the exampel the PWM Pin LED1 is modulating but if i do this all LEDs are toggeling.

the Handbook isn't realy a helb becaouse he did PWM with Timers.

Thanks for answare

posted by Jovica D. 16 Apr 2013

David is correct, the 11U24 does have a PWM unit, just not for the LEDs.

posted by Erik - 16 Apr 2013

Jovica connect an external LED with series resistant to a pin with PWM e.g. Pin5 and set line 3 of the example to PwmOut led(p5);

posted by David Golz 17 Apr 2013

Thank you David

posted by Jovica D. 17 Apr 2013