//for the switches
int k = 0;
int r = 0;
//for the motor to work
#include <Servo.h>
Servo myServo;
void setup() {
Serial.begin(9600);
//lighhts
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
// for the motor
myServo. attach(6);
}
void loop() {
// switchs
k = digitalRead(7);
r = digitalRead(5);
//to turn on and off the light to tell if the switch is on or off and to make it move to lower
if ( k == HIGH){
digitalWrite(9, HIGH);
myServo.write(150);
delay(1000);
}
else{
myServo.write(90);
digitalWrite(9, LOW);
}
//to turn on and off the light to tell if the switch is on or off and to make keep up
if ( r == HIGH){
digitalWrite(8, HIGH);
myServo.write(30);
delay(1000);
}
else{
digitalWrite(8, LOW);
myServo.write(90);
}
}