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,
-
i declare my variables : courant, tension, puissance, derivé, alpha, tension0=0 and puissance0=0.
-
Now it’s simple, i want to convert 2 analog entries coming from a source
==> entry 1: tension entreey : courant
- 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;
- Finally from the variable “alpha” that i get in the end, i want to generate a variable PWM signal with a frequency of 5KHz