Obviously it doesn't work on my Arduino Yùn (which has the same Leonardo uC Atmega32u4). How should i change the code? I have never used this kind of notation and i can't understand the meaning of each command (i took a look at the datasheet but it's very hard to decode for me).
AnalysIR:
For the benefit of others, it might be useful to post the actual solution that worked for you (i.e. code).
Of course!
1 - Download and install this version of PWM library: link PWM Leonardo
2 - If you want some examples, you can find them inside this older version of the library (copy only the examples!) : older version
3 - If you want to produce a continuous 38 kHz carrier (pwm @ 50% duty cycle) use this code in the setup() :
#define pwmPin 10
#define frequency 38000
void setup(){
//initialize all timers except for 0, to save time keeping functions
InitTimersSafe();
//sets the frequency for the specified pin
bool success = SetPinFrequencySafe(pwmPin, frequency);
pwmWrite(pwmPin, 128);
}