Wet & Dry Waste Smart Dustbin for House | Best science Project | Harish Projects
Watch Full Detailed video 👇🏻 Diagram in Video👆 //Arduino Code// //YouTube: Harish Projects //Order Electronic Parts & Project kit: HarishProjects.com // #include <Servo.h> Servo servo1; const int trigPin = 12; const int echoPin = 11; long duration; int distance=0; int potPin = A0; //input pin int soil=0; int fsoil; void setup() { Serial.begin(9600); //Serial.print("Humidity"); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); servo1.attach(8); } void loop() { //YouTube: Harish Projects //Order Electronic Parts & Project kit: HarishProjects.com // int soil=0; for(int i=0;i<2;i++) { digitalWrite(trigPin, LOW); delayMicroseconds(7); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); delayMicroseconds(10); duration = pulseIn(echoPin, HIGH); distance= duration*0.034/2+distance; delay(10); } distance=distance/2; Serial.println(distance); if ...
Comments
motors are not rotating
Contact number 6361687608
int sensor_pin = 5;
int tap_servo_pin =4;
Please tell me what's the problem.
#include
const int soilMoisturePin = A0;
const int servoPin = 9; // Adjust these pin numbers according to your setup
const int servo2Pin = 10; // Second servo pin
const int moistureThreshold = 500; // Adjust this value according to your sensor's readings
Servo bridgeServo;
Servo bridgeServo2;
// Define angles for lifted and lowered positions
const int liftedAngle = 90;
const int loweredAngle = 0;
void setup() {
pinMode(soilMoisturePin, INPUT);
bridgeServo.attach(servoPin);
bridgeServo2.attach(servo2Pin);
}
void loop() {
int moistureLevel = analogRead(soilMoisturePin);
if (moistureLevel < moistureThreshold) {
// If soil is moist enough, lift the bridge
liftBridge();
} else {
// Otherwise, keep the bridge down
lowerBridge();
}
}
void liftBridge() {
// Move the servo motors to lift the bridge
bridgeServo.write(liftedAngle); // Use lifted angle
bridgeServo2.write(liftedAngle); // Second servo angle
delay(1500); // Adjust delay as needed
}
void lowerBridge() {
// Move the servo motors to lower the bridge
bridgeServo.write(loweredAngle); // Use lowered angle
bridgeServo2.write(loweredAngle); // Second servo angle
delay(1500); // Adjust delay as needed
}
You should change the signal pin number to 9 and 10
Could someone ping the correct code,it will me more helpful for the students who are working on it.