update
This commit is contained in:
parent
284f89dc62
commit
4120d69772
|
@ -21,8 +21,8 @@ void loop()
|
||||||
static float curent;
|
static float curent;
|
||||||
static int pwm_value = 0;
|
static int pwm_value = 0;
|
||||||
curent = get_curent();
|
curent = get_curent();
|
||||||
Serial.println(pwm_value);
|
Serial.println(curent);
|
||||||
if(curent<target_curent*0.9)
|
if(curent<target_curent*0.95)
|
||||||
{
|
{
|
||||||
pwm_value++;
|
pwm_value++;
|
||||||
analogWrite(__PWM_OUT__, pwm_value);
|
analogWrite(__PWM_OUT__, pwm_value);
|
||||||
|
@ -32,7 +32,7 @@ void loop()
|
||||||
pwm_value--;
|
pwm_value--;
|
||||||
analogWrite(__PWM_OUT__, pwm_value);
|
analogWrite(__PWM_OUT__, pwm_value);
|
||||||
}
|
}
|
||||||
delay(50);
|
delay(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
float get_curent()
|
float get_curent()
|
||||||
|
@ -40,8 +40,8 @@ float get_curent()
|
||||||
int b = analogRead(__ANALOGIN_BR__);
|
int b = analogRead(__ANALOGIN_BR__);
|
||||||
int a = analogRead(__ANALOGIN_AR__);
|
int a = analogRead(__ANALOGIN_AR__);
|
||||||
float dv = (b-a)*(5.0/1023.0) ; //Tension réel
|
float dv = (b-a)*(5.0/1023.0) ; //Tension réel
|
||||||
float curent = (dv/(float)__RESISTOR_VALUE__)*100;
|
float curent = (dv/(float)__RESISTOR_VALUE__)*1000;
|
||||||
|
|
||||||
Serial.print(a);Serial.print(";");Serial.print(b);Serial.print(";");Serial.print(dv);Serial.print(";");Serial.print(curent);Serial.print(";");
|
//Serial.print(a);Serial.print(";");Serial.print(b);Serial.print(";");Serial.print(dv);Serial.print(";");Serial.print(curent);Serial.print(";");
|
||||||
return curent;
|
return curent;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue