Hello Károly,
Nothing seems to be wrong with your code. After replacing
PwmOut led(p21);
with
PwmOut led(LED1);
it works fine on my LPC1768.
I’d suggest to check the settings of your serial terminal program and the LED connected to the pin p21. Maybe you should swap the wires.
NOTE: To get the code formatted, in your post add a line with three backtick characters (available over the same key as the “~” character) at the begin and end of your code.