Berikut Video Tutorialnya: (jangan lupa subcribe) #Arduino
Link alat dan bahan membuat pencetan sabun otomatis:
1. Arduino nano: https://s.shopee.co.id/9AKesP76xI
2. Sensor inframerah:https://s.shopee.co.id/4qBfisNUhv
3. Motor servo 996 R:https://s.shopee.co.id/901EgRCWxm
4. Kabel jumper:https://s.shopee.co.id/5fkPs05NZA
5. Baterai: https://s.shopee.co.id/LjGMq8Ejd
6. Tempat baterai 18650+saklar: https://s.shopee.co.id/8phReDIPk4
7. Breadboard: https://s.shopee.co.id/2BAvUGq9bB
Kode Program yang di gunakan:
#include <Servo.h>
Servo servoMotor;
int pinIR = 2; // <- kurang titik koma
int statusIR = 0;
void setup() {
pinMode(pinIR, INPUT);
servoMotor.attach(9);
servoMotor.write(0);
}
void loop() {
statusIR = digitalRead(pinIR);
if (statusIR == LOW) {
servoMotor.write(100); // <- kurang tanda )
delay(700);
servoMotor.write(0);
delay(2000);
}
}
Tidak ada komentar:
Posting Komentar