التوصيل :
الكود :
#include <Servo.h>
int right = 10;
int left = 11;
Servo Badr;
void setup(){
pinMode(right,INPUT);
pinMode(left,INPUT);
Badr.attach(5);
digitalWrite(right,HIGH);
digitalWrite(left,HIGH);
Badr.write(90);
}
void loop(){
if(digitalRead(right)==LOW){
Badr.write(180);
}
if(digitalRead(left)==LOW){
Badr.write(0);
}
}
int right = 10;
int left = 11;
Servo Badr;
void setup(){
pinMode(right,INPUT);
pinMode(left,INPUT);
Badr.attach(5);
digitalWrite(right,HIGH);
digitalWrite(left,HIGH);
Badr.write(90);
}
void loop(){
if(digitalRead(right)==LOW){
Badr.write(180);
}
if(digitalRead(left)==LOW){
Badr.write(0);
}
}
ليست هناك تعليقات:
إرسال تعليق