I need help in my new project

i worked on an STM32 2 weeks ago, but it seems that it'll be alot easier if i changed my ùcontroller to Arduino, i just need some help cause i'm new to arduino environement.
Well to be brief,

  1. i declare my variables : courant, tension, puissance, derivé, alpha, tension0=0 and puissance0=0.
  2. Now it's simple, i want to convert 2 analog entries coming from a source
    ==> entry 1: tension entreey : courant
  3. I calculate

puissance=courant*tension;
derive=(puissance-puissance0)/(tension-tension0);

if(derive==0)
{
alpha =alpha0;
}
else if (derive>0)
{
alpha=alpha0+1;
}
else
{
alpha=alpha0-1;
}

alpha0=alpha;
tension0=tension;
puissance0=puissance;
4) Finally from the variable "alpha" that i get in the end, i want to generate a variable PWM signal with a frequency of 5KHz

i just need some help cause i'm new to arduino environement.

What help do you need? Aside from changing the PWM frequency, the rest is trivial.

Why do you need a specific frequency for the duty cycle?

Well it's just that i don't get it much from examples ><" i just need some programming advice, like how to use analog inputs something like that
and i need a specific frequency cause it's already fixed by the system before going into the gatting

i just need some programming advice, like how to use analog inputs something like that

and i need a specific frequency cause it's already fixed by the system before going into the gatting

Clear as mud.