Hello guys, I'm using a smart bridge where the moisture sensor input should turn on the buzzer and after 3 seconds the buzzer should be off and the servo motor should turn to 90 degrees. Can I get the idea of the programming. Can some one help with the programming.
You’re halfway there…
Write code for each separate action as a standalone sketch, so you know how each element works…
Then tie the pieces together into a single program, and 30 minutes later, you’ll have a complete solution.
Improvements might include using ‘functions’ , and replacing delay() with millis() timing.
How to check the code from this file. Can you explain out
The other link is to the project and describes the devices needed and connections.
This is the sample Arduino sketch.
#include <Servo.h>
#include <Servo.h>
Servo tap_servo;
int sensor_pin = 4;
int tap_servo_pin =5;
int val;
void setup(){
pinMode(sensor_pin,INPUT);
tap_servo.attach(tap_servo_pin);
}
void loop(){
val = digitalRead(sensor_pin);
if (val==0)
{tap_servo.write(0);
}
if (val==1)
{tap_servo.write(90);
}
}
I done upto this . Can you please help by checking it.
Also how to implement buzzer in this ..
It works!
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.