PROYEK PENCETAN SABUN OTOMARIS


 Berikut Video Tutorialnya: (jangan lupa subcribe) #Arduino


Link alat dan bahan membuat pencetan sabun otomatis:
6. Tempat baterai 18650+saklar: https://s.shopee.co.id/8phReDIPk4


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