Hello,
I am trying to control a throttle body from Citroën with an arduino mega and a L298 (from DF robots). My system is working but the response of the throttle body is kind of random and not efficient.
Every connection are ok, I am delivering the right current and the right voltage to everything but I don't know why the response is not instantaneous. I control everything with a potentiometer and the mapping are working well, it is just the response that is not working. My code looks like this :
int E1 = 6;
int M1 = 7;
int value=5;
int potentio = 0;
float pourcent = 0;
void setup()
{
pinMode(M1, OUTPUT);
Serial.begin(9600);
}
void loop()
{
float TPS1 = analogRead(A3);
float TPS2 = analogRead(A5);
potentio = analogRead(A1);
potentio = map(potentio,0,702,0,255);
pourcent = map(TPS1,156,964,0,100);
value = potentio;
digitalWrite(M1,HIGH);
analogWrite(E1, value); //PWM Speed Control
delay(500); // fréquence à modifier
}