#include <LCD_I2C.h>
LCD_I2C lcd(0x27, 16, 2);
#include <Servo.h>
Servo servo1;
Servo servo2;
int door = 11;
int mic = 3;
void setup() {
// put your setup code here, to run once:
lcd.begin();
lcd.backlight();
Serial.begin(9600);
servo1.attach(door);
servo2.attach(mic);
servo1.write(0);
servo2.write(0);
}
void loop() {
// put your main code here, to run repeatedly:
for(int a = 0; a <=180; a++){
servo1.write(a);
lcd.setCursor(0,0);
lcd.print("Door angle: ");
lcd.print(a);
delay(20);
}
for(int a = 180; a >= 0; a--){
servo1.write(a);
lcd.setCursor(0,0);
lcd.print("Door angle: ");
lcd.print(a);
delay(20);
}
for(int j = 0; j <= 180; j++){
servo2.write(j);
lcd.setCursor(0,2);
lcd.print("Mic angle: ");
lcd.print(j);
delay(20);
}
for(int j = 180; j >= 0; j--){
servo2.write(j);
lcd.setCursor(0,2);
lcd.print("Mic angle: ");
lcd.print(j);
delay(20);
}
}