Circuit:-
Code:-
#include<Servo.h>
Servo servo;
int count = 0;
char input[12];
void setup() {
Serial.begin(9600);
servo.attach(8);
servo.write(0);
}
void loop() {
if(Serial.available())
{
count = 0;
while(Serial.available() && count < 12)
{
input[count] = Serial.read();
count++;
delay(5);
}
if(input[0] == '4' && input[1] == '0' && input[2] == '0' && input[3] == '0' &&
input[4] == '3' && input[5] == '5' && input[6] == '0' && input[7] == '5' &&
input[8] == '9' && input[9] == '1' && input[10] == 'E' && input[11] == '1' )
{
servo.write(90);
delay(2000);
servo.write(0);
}
}
}