mauvauais raport resistance pont

This commit is contained in:
Adrien Van 2017-02-15 22:08:17 +01:00
parent 84524e04fe
commit 9a0c4ca74c
2 changed files with 15 additions and 15 deletions

View File

@ -4,7 +4,7 @@
#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,820); courant base(A2,A3,820,1,1,0.5,0.5);
/* /*
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

View File

@ -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 = 0; bridgeU1RapportR = 1;
bridgeU2RapportR = 0; bridgeU2RapportR = 1;
} }
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 = 0; bridgeU2RapportR = 1;
} }
else else
{ {
this->bridgeU1Enable = 0; this->bridgeU1Enable = 1;
this->bridgeU2Enable = bridgeU2Enable; this->bridgeU2Enable = bridgeU2Enable;
bridgeU1RapportR = 0; bridgeU1RapportR = 1;
if(bridgeU2Enable) if(bridgeU2Enable)
bridgeU2RapportR = va_arg(ap, double); bridgeU2RapportR = va_arg(ap, double);
else else
bridgeU2RapportR = 0; bridgeU2RapportR = 1;
} }
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 = 0; bridgeU1RapportR = 1;
bridgeU2RapportR = 0; bridgeU2RapportR = 1;
} }
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 = 0; bridgeU2RapportR = 1;
} }
else else
{ {
this->bridgeU1Enable = 0; this->bridgeU1Enable = 1;
this->bridgeU2Enable = bridgeU2Enable; this->bridgeU2Enable = bridgeU2Enable;
bridgeU1RapportR = 0; bridgeU1RapportR = 1;
if(bridgeU2Enable) if(bridgeU2Enable)
bridgeU2RapportR = va_arg(ap, double); bridgeU2RapportR = va_arg(ap, double);
else else
bridgeU2RapportR = 0; bridgeU2RapportR = 1;
} }
va_end(ap); va_end(ap);
} }
@ -101,8 +101,8 @@ void courant::lireTension()
u1RAW = analogRead(pinU1); u1RAW = analogRead(pinU1);
u2RAW = analogRead(pinU2); u2RAW = analogRead(pinU2);
u1 = (u1RAW*(5.0/1024.0))*(bridgeU1RapportR+1); u1 = (u1RAW*(5.0/1024.0))*(1/bridgeU1RapportR);
u2 = (u2RAW*(5.0/1024.0))*(bridgeU2RapportR+1); u2 = (u2RAW*(5.0/1024.0))*(1/bridgeU2RapportR);
} }
double courant::lireCourant() double courant::lireCourant()