Probleme au niveau du calcul du pont
This commit is contained in:
parent
cdb747dd5e
commit
84524e04fe
|
@ -1,10 +1,10 @@
|
||||||
#include "mesure.h"
|
#include "mesure.h"
|
||||||
|
|
||||||
#define __PIN_PWM__ 3
|
#define __PIN_PWM__ 3
|
||||||
//#define DEBUG
|
#define DEBUG
|
||||||
float target_curent = 0.05;//ma
|
float target_curent = 0.05;//ma
|
||||||
courant collecteur(A0,A1,100,1,1,0.248,0.248); // R1 10K, R2 3K3
|
courant collecteur(A0,A1,100,1,1,0.248,0.248); // R1 10K, R2 3K3
|
||||||
courant base(A2,A3,10000);
|
courant base(A2,A3,820);
|
||||||
/*
|
/*
|
||||||
courant collecteur(Potentien Haut U1,Potentiel Bas U2,Resistance[,Pon résistif sur U1,Pon résistif sur U2, Raport Résistance U1, Raport Résistance U2]);
|
courant collecteur(Potentien Haut U1,Potentiel Bas U2,Resistance[,Pon résistif sur U1,Pon résistif sur U2, Raport Résistance U1, Raport Résistance U2]);
|
||||||
par ex
|
par ex
|
||||||
|
@ -43,6 +43,7 @@ void loop()
|
||||||
analogWrite(__PIN_PWM__, PWMCourent);
|
analogWrite(__PIN_PWM__, PWMCourent);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Serial.print("PWM:");Serial.print(PWMCourent);
|
Serial.print("PWM:");Serial.print(PWMCourent);
|
||||||
Serial.print("\tIBase:");Serial.println(base.lireCourant());
|
Serial.print("\tIBase:");Serial.print(base.lireCourant());Serial.print("\tU1:");Serial.print(base.lireTensionU1());
|
||||||
|
Serial.print("U2");Serial.println(base.lireTensionU2());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
22
mesure.cpp
22
mesure.cpp
|
@ -12,8 +12,8 @@ courant::courant(uint8_t pinU1, uint8_t pinU2, int r)
|
||||||
pinMode(pinU2, 0);
|
pinMode(pinU2, 0);
|
||||||
bridgeU1Enable = 0;
|
bridgeU1Enable = 0;
|
||||||
bridgeU2Enable = 0;
|
bridgeU2Enable = 0;
|
||||||
bridgeU1RapportR = 1;
|
bridgeU1RapportR = 0;
|
||||||
bridgeU2RapportR = 1;
|
bridgeU2RapportR = 0;
|
||||||
}
|
}
|
||||||
courant::courant(uint8_t pinU1, uint8_t pinU2, int r, uint8_t bridgeU1Enable, uint8_t bridgeU2Enable,...)
|
courant::courant(uint8_t pinU1, uint8_t pinU2, int r, uint8_t bridgeU1Enable, uint8_t bridgeU2Enable,...)
|
||||||
{
|
{
|
||||||
|
@ -36,17 +36,17 @@ courant::courant(uint8_t pinU1, uint8_t pinU2, int r, uint8_t bridgeU1Enable, ui
|
||||||
if(bridgeU2Enable)
|
if(bridgeU2Enable)
|
||||||
bridgeU2RapportR = va_arg(ap, double);
|
bridgeU2RapportR = va_arg(ap, double);
|
||||||
else
|
else
|
||||||
bridgeU2RapportR = 1;
|
bridgeU2RapportR = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->bridgeU1Enable = 0;
|
this->bridgeU1Enable = 0;
|
||||||
this->bridgeU2Enable = bridgeU2Enable;
|
this->bridgeU2Enable = bridgeU2Enable;
|
||||||
bridgeU1RapportR = 1;
|
bridgeU1RapportR = 0;
|
||||||
if(bridgeU2Enable)
|
if(bridgeU2Enable)
|
||||||
bridgeU2RapportR = va_arg(ap, double);
|
bridgeU2RapportR = va_arg(ap, double);
|
||||||
else
|
else
|
||||||
bridgeU2RapportR = 1;
|
bridgeU2RapportR = 0;
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
@ -59,8 +59,8 @@ void courant::config(uint8_t pinU1, uint8_t pinU2, int r)
|
||||||
pinMode(pinU2, 0);
|
pinMode(pinU2, 0);
|
||||||
bridgeU1Enable = 0;
|
bridgeU1Enable = 0;
|
||||||
bridgeU2Enable = 0;
|
bridgeU2Enable = 0;
|
||||||
bridgeU1RapportR = 1;
|
bridgeU1RapportR = 0;
|
||||||
bridgeU2RapportR = 1;
|
bridgeU2RapportR = 0;
|
||||||
}
|
}
|
||||||
void courant::config(uint8_t pinU1, uint8_t pinU2, int r, uint8_t bridgeU1Enable, uint8_t bridgeU2Enable, ...)
|
void courant::config(uint8_t pinU1, uint8_t pinU2, int r, uint8_t bridgeU1Enable, uint8_t bridgeU2Enable, ...)
|
||||||
{
|
{
|
||||||
|
@ -82,17 +82,17 @@ void courant::config(uint8_t pinU1, uint8_t pinU2, int r, uint8_t bridgeU1Enable
|
||||||
if(bridgeU2Enable)
|
if(bridgeU2Enable)
|
||||||
bridgeU2RapportR = va_arg(ap, double);
|
bridgeU2RapportR = va_arg(ap, double);
|
||||||
else
|
else
|
||||||
bridgeU2RapportR = 1;
|
bridgeU2RapportR = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->bridgeU1Enable = 0;
|
this->bridgeU1Enable = 0;
|
||||||
this->bridgeU2Enable = bridgeU2Enable;
|
this->bridgeU2Enable = bridgeU2Enable;
|
||||||
bridgeU1RapportR = 1;
|
bridgeU1RapportR = 0;
|
||||||
if(bridgeU2Enable)
|
if(bridgeU2Enable)
|
||||||
bridgeU2RapportR = va_arg(ap, double);
|
bridgeU2RapportR = va_arg(ap, double);
|
||||||
else
|
else
|
||||||
bridgeU2RapportR = 1;
|
bridgeU2RapportR = 0;
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ void courant::lireTension()
|
||||||
double courant::lireCourant()
|
double courant::lireCourant()
|
||||||
{
|
{
|
||||||
lireTension();
|
lireTension();
|
||||||
double i = ((u1-u2)/820.0)*1000;
|
double i = ((u1-u2)/(double)r)*1000;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue