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.
7 years, 3 months ago.
LPC1768. PWM works only with p21.
Here is my code:
#include "mbed.h" Serial pc(USBTX, USBRX); PwmOut An_Out(p21); An_Out.period_ms(2); float brightness = 0.0; int main() { while(1) { char c = pc.getc(); if((c == 'u') && (brightness < 0.99)) { brightness += 0.01; An_Out = brightness; if((c == 'd') && (brightness > 0.0)) { brightness -= 0.01; An_Out = brightness; } }
PWM works fine but only for p.21. If I assign it to any other pin (p10, p11, ...p20..) it won't work. LED1-LED4 start blinking: "Lights of Death" and that's it. Am I missing something here?
Please advise!
1 Answer
7 years, 3 months ago.
Check documentation first! PWM pins on LPC1768: p21-p26.