Skip to content

Instantly share code, notes, and snippets.

@Mamin0679
Forked from ulitiy/CatFeeder.ino
Created November 29, 2023 02:23
Show Gist options
  • Save Mamin0679/4b600eb73cdc5ea19171c0c96a0c1782 to your computer and use it in GitHub Desktop.
Save Mamin0679/4b600eb73cdc5ea19171c0c96a0c1782 to your computer and use it in GitHub Desktop.
#include <Servo.h>
Servo myservo;
const int servoPin = 9;
const int buttonPin = 12;
const int ledPin = 13;
void setup() {
myservo.attach(servoPin);
pinMode(buttonPin, INPUT);
digitalWrite(buttonPin, HIGH);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
myservo.write(180);
delay(1000);
myservo.detach();
}
void loop() {
int buttonVal = digitalRead(buttonPin);
if(buttonVal == LOW) {
myservo.attach(servoPin);
myservo.write(30);
delay(575);
myservo.write(180);
delay(1500);
myservo.detach();
delay(5000);
}
delay(13);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment