Automatic Soap Dispenser Using Maker UNO

INTRODUCTION

The number of people who have tested positive for Covid-19 is increasing😰😰. One of the ways to protect us from the coronavirus is to wash our hands🖐 regularly using soap🧼. So, please wash your hand frequently with soap and stay at home.

HARDWARE PREPARATION

This tutorial use :

Software Preparation.

Sample Code

This is the sample code used for this tutorial. Try it!

#include <Servo.h>
Servo myservo1; // create servo object to control a servo1
Servo myservo2; // create servo object to control a servo2
const int sensorPin = 3; // the number of the IR sensor pin
int sensorState = 0; // variable for reading the IR sensor status
void setup() {
// initialize the IR sensor pin as an input:
pinMode(sensorPin, INPUT);
myservo1.attach(5);
myservo2.attach(6);
}
void loop() {
// read the state of the IR sensor value:
sensorState = digitalRead(sensorPin);
// check if the sensor detects any object. If it is, the sensorState is HIGH:
if (sensorState == HIGH) {
myservo1.write(180); // sets the servo position to 180 degree
myservo2.write(0); // sets the servo position to 0 degree
delay(15);
} else {
myservo1.write(0); // sets the servo position to 0 degree
myservo2.write(180); // sets the servo position to 180 degree
delay(15);
}
}
view raw soap_dispenser.ino hosted with ❤ by GitHub

Thank you

Thank you for reading this tutorial and we hope it helps your project development. If you have any technical inquiry, please post at Cytron Technical Forum.

1 thought on “Automatic Soap Dispenser Using Maker UNO”

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

Smart Door Announcer with Raspberry Pi
Why Raspberry Pi is the future of computing devices?
Face Recognition Door Lock System Using OpenCV on Raspberry Pi
Send Data to Firebase Using Arduino Uno WiFi Rev2
Simple Alarm System Using Maker Nano
Scroll to Top