lab motor 9/20/2018




#include <Servo.h>
const int SERVO=9;
const int PIR=2;//The PIR is connected to pin 2
Servo myServo;

void setup()
{
 myServo.attach(SERVO);

}
void loop()
{
  if ( digitalRead(PIR)==LOW)
  {myServo.attach(180);
  delay(15);}
  else {
 myServo.attach(0);
 delay(15);
}}

Comments

Popular posts from this blog