Automatic Fish Feeder Mechanism with Timer by using Arduino || Fish Feeder DIY

Описание к видео Automatic Fish Feeder Mechanism with Timer by using Arduino || Fish Feeder DIY

Automatic Fish Feeder Mechanism with Timer by using Arduino || Automatic Fish Feeder DIY
Scroll down for code.....
Please like & Subscribe for more videos

Real Time Clock (DS1302) library
http://www.rinkydinkelectronics.com/l...

If you want to support my video please buy any product through my amazon affiliate link. I will receive a commission, at no extra cost to you.

LIST OF COMPONENT (affiliate links)

http://amzn.to/2fvSRJq (Arduino)
http://amzn.to/2weYm4R (servo motor)
http://amzn.to/2gRFSiv (RTC DS1302)
http://amzn.to/2vJ3lvo (Jumper wire)
Plastic bottle,
Cardboard,
Pen.

#include (DS1302.h) //instead of parenthesis () put angle bracket as YouTube description does not allow angle bracket
#include (Servo.h)
Time t;
Servo myservo;
int Hour;
int Min;
int Sec;
// Init the DS1302
DS1302 rtc(2, 3, 4);

void setup()
{
myservo.attach(9);
myservo.write(45);
// Set the clock to run-mode, and disable the write protection
rtc.halt(false);
rtc.writeProtect(false);
Serial.begin(9200);
// The following lines can be commented out to use the values already stored in the DS1302
rtc.setDOW(SUNDAY); // Set Day-of-Week to SUNDAY
rtc.setTime(8, 59, 50); // Set the time to 12:00:00 (24hr format)
rtc.setDate(8, 25, 2019); // Set the date to August 25th, 2019
}

void loop()
{
t = rtc.getTime();
Hour = t.hour;
Min = t.min;
Sec = t.sec;
// Serial.print(Hour);
// Serial.print(":");
// Serial.print(Min);
// Serial.print(":");
// Serial.println(Sec);

//set the time for fish feeding
if ((Hour== 10 && Min== 0 && Sec== 2)||(Hour== 21 && Min== 0 && Sec== 2)) {
myservo.write(0);
delay (300);
myservo.write(45);
delay (300);}
}

Комментарии

Информация по комментариям в разработке