What's app guys !
I'm a new user in the arduino's world and I've just registered to this forum , any welcomes ? ![]()
Well,
I'm trying to make my first artificial intelligent project realising a robot which can move in four directions using two DC motors I used a L293D as well,
while programming this stuff I met a problem I donno why something went wrong with it,
so the picture contains a simulation of my system and this is the code of my program
I'm using a bluetooth commande so that's why I set a virtual terminal !
int x,vi1=50,vi2=50;
void accelerer(int vi,int ep){
vi+=20;
if(vi>255)vi=200;
analogWrite(ep,vi);
delay(100);
}
void ralentir(int vi,int ep){
vi-=20;
if(vi<0)vi=20;
analogWrite(ep,vi);
delay(100);
}
int motorPin;
void setup() {
 pinMode(13,OUTPUT);
 pinMode(9,OUTPUT);
 pinMode(3,OUTPUT);
 pinMode(2,OUTPUT);
 pinMode(6,OUTPUT);
 pinMode(5,OUTPUT);
 Serial.begin(9600);
}
void loop() {
 if(Serial.available()>0){
 x=Serial.read();
 }
 if(x=='A'){
  digitalWrite(6,HIGH);
  analogWrite(13,50);
  digitalWrite(9,LOW);
  if(x=='F')accelerer(vi1,13);
  else if(x=='G')ralentir(vi1,13);
  }
  Â
 if(x=='B'){
  analogWrite(9,HIGH);
 digitalWrite(13,LOW);
 digitalWrite(6,50);
  if(x=='F')accelerer(vi1,6);
  else if(x=='G')ralentir(vi1,6);
   }
  if(x=='C'){
 analogWrite(5,HIGH);Â
 digitalWrite(2,LOW);
 digitalWrite(3,50);
  if(x=='H')accelerer(vi2,4);
  else if(x=='I')ralentir(vi2,4);
   }
  if(x=='D'){
  analogWrite(5,HIGH);
  digitalWrite(2,50);
  digitalWrite(3,LOW);
  if(x=='H')accelerer(vi2,4);
  else if(x=='I')ralentir(vi2,4);
   }
 if(x=='E'){
 digitalWrite(13,LOW);
 digitalWrite(9,LOW);
   }
 if(x=='J'){
 digitalWrite(3,LOW);
 digitalWrite(2,LOW);
   }
}
I tried the digitalWrite function with En1 and En2 and with expected HIGH voltage MotorPin and got no results ![]()
thank you in advance and sorry for the bad accent haha ![]()



