L298N Motor Sürücü
Bağlantı Şeması
Örnek Kodu
int motor_sag1=11;
int motor_sag2=12;
int motor_so11=9;
int motor_so12=8;
void setup() {
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
pinMode(9,OUTPUT);
pinMode(8,OUTPUT);
}
void loop() {
ileri();
delay(1000);
geri();
delay(1000);
sag_don();
delay(1000);
sol_don();
delay(1000);
}
void ileri(){
digitalWrite(11,HIGH);
digitalWrite(12,LOW);
digitalWrite(9,HIGH);
digitalWrite(8,LOW);
}
void geri(){
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
digitalWrite(8,HIGH);
digitalWrite(9,LOW);
}
void sag_don(){
digitalWrite(11,LOW);
digitalWrite(12,LOW);
digitalWrite(9,HIGH);
digitalWrite(8,LOW);
}
void sol_don(){
digitalWrite(11,HIGH);
digitalWrite(12,LOW);
digitalWrite(9,LOW);
digitalWrite(8,LOW);
}