Introduction: Arduino Tinker CAD Smart Dustbin
HI!!! Want to make your work easier by making a smart dustbin, check out this instructable for them.
Supplies
All what you need are simple components:
*Arduino UNO
*Servo Motar
*Ultrasonic sensor
*Arduino A to B cable(For Programming)
*PC or Laptop( For coding)
*Arduino IDE app
*Dustbin
*Happiness to start this wonderfull project
Step 1: Connecting the Circuits
All what you need to do is just see the image and connect your circuits.
Step 2: CODING YOUR PROJECT
COPY THE FOLLOWING CODE AND CODE YOUR PROJECT CONNECTING IT TO YOUR PC OR LAPTOP WITH THE ARDUINO IDE APP
#include<Servo.h>
Servo servoMain; // Define our Servo
int trigpin = 10;
int echopin = 11;
int distance;
float duration;
float cm;
void setup()
{ servoMain.attach(9); // servo on digital pin 10
pinMode(trigpin, OUTPUT);
pinMode(echopin, INPUT); }
void loop()
{ digitalWrite(trigpin, LOW);
delay(2);
digitalWrite(trigpin, HIGH);
delayMicroseconds(10);
digitalWrite(trigpin, LOW);
duration = pulseIn(echopin, HIGH);
cm = (duration/58.82);
distance = cm;
if(distance<30)
{
servoMain.write(180); // Turn Servo back to center position (90 degrees)
delay(3000); }
else{ servoMain.write(0);
delay(50);
}
}
Step 3: TUTORIAL

Participated in the
Arduino Contest 2020
Comments