#include<Servo.h>
const int BUTTON_PIN = 7;
int BUTTON;
const int RELAY_PIN = 8;
Servo myservo;
void setup() {
// put your setup code here, to run once:
pinMode(BUTTON_PIN, INPUT);
pinMode(RELAY_PIN, OUTPUT);
Serial.begin(9600);
myservo.attach(6);
}
void loop() {
// put your main code here, to run repeatedly:
myservo.attach(6);
BUTTON = digitalRead(BUTTON_PIN);
Serial.print(BUTTON);
if(BUTTON == 1){
digitalWrite(RELAY_PIN, HIGH);
myservo.write(70);
}else{
myservo.write(180);
}
delay(1000);
}