- Driver Motor DC (Rangkaian driver motor dc relay)
- board arduino
- power supply
- kabel
sambungkan port input pada driver motor dc ke port digital (pin 3, pin 4, pin 5 dan pin 6). cobalah buat program seperti dibawah ini
#define ka1 3 //pin 3
#define ka2 4 //pin 4
#define ki1 5 //pin 5
#define ki2 6 //pin 6
void setup() {
// set the digital pin as output:
#define ka2 4 //pin 4
#define ki1 5 //pin 5
#define ki2 6 //pin 6
void setup() {
// set the digital pin as output:
pinMode(ka1, OUTPUT);
pinMode(ka2, OUTPUT);
pinMode(ki1, OUTPUT);
pinMode(ki2, OUTPUT);
digitalWrite(ka2, HIGH);
digitalWrite(ka1, HIGH);
digitalWrite(ki2, HIGH);
digitalWrite(ki1, HIGH);
}
void loop()
{
digitalWrite(ka1, HIGH);
digitalWrite(ka2, LOW);
digitalWrite(ki1, HIGH);
digitalWrite(ki2, LOW);
delay(1000);
digitalWrite(ka1, LOW);
digitalWrite(ka2, HIGH);
digitalWrite(ki1, LOW);
digitalWrite(ki2, HIGH);
delay(1000);
}
pinMode(ka2, OUTPUT);
pinMode(ki1, OUTPUT);
pinMode(ki2, OUTPUT);
digitalWrite(ka2, HIGH);
digitalWrite(ka1, HIGH);
digitalWrite(ki2, HIGH);
digitalWrite(ki1, HIGH);
}
void loop()
{
digitalWrite(ka1, HIGH);
digitalWrite(ka2, LOW);
digitalWrite(ki1, HIGH);
digitalWrite(ki2, LOW);
delay(1000);
digitalWrite(ka1, LOW);
digitalWrite(ka2, HIGH);
digitalWrite(ki1, LOW);
digitalWrite(ki2, HIGH);
delay(1000);
}
relay akan aktif jika di beri kondisi 0 (low)
selamat mencoba