i builded a simple car with arduino r3 uno and l289n
the problem is...coding.
i tried to learn to make my mini car go up but it just go around and around although both motor moving
here is the code
int Ain1=2,Ain2=3,Bin1=4,Bin2=5;
void setup() {
pinMode(Ain1,OUTPUT);
pinMode(Ain2,OUTPUT);
pinMode(Bin1,OUTPUT);
pinMode(Bin2,OUTPUT);
pinMode(9,OUTPUT);//9 is ENA
pinMode(10,OUTPUT);//10 is ENB
delay(2000);
analogWrite(9,100);
analogWrite(10,200);
digitalWrite(Ain1, LOW);
digitalWrite(Ain2, HIGH);
digitalWrite(Bin1, LOW);
digitalWrite(Bin2, HIGH);
delay(2000);
analogWrite(9,0);
analogWrite(10,0);
}
void loop() {
}
i learn coding myself so i would like you guys can help me as much as you guys can, thks
Look at the motor (that you don't appear to use) library examples. Lots to pick from, the best is a matter of experience and luck. We all started there.
i will try later cuz i and my friends will have a tutorial how to build a mini arduino car in school (i have tried to build and code it in new year to prepare so i wont be confuse)
Depending on your definition of "around and around" you have one motor connected backwards or not connected.
[edit]
Here is an L298N steering simulation that might help (you will need to change motor and enable pins). Four basic steering. Six skid steering. Six PWM steering.