التحكم في محرك السيرفو باي جهاز تحكم

 التحكم في محرك السيرفو بأي جهاز تحكم 

Remote control servo motor

المكونات واللوازم

  Arduino nano    /  اردوينو نانو 

   IR sensor    / مستقبل الاشعة تحت الحمراء


محرك السيرفو     /   servo motor

                                       



جهاز التحكم  / Remote Control 

طريقة الربط /Conduction


اكود البرمجي / The programming 


#include <IRremote.h>
#include <Servo.h>
int IRpin = 11;  // pin for the IR sensor
IRrecv irrecv(IRpin);
decode_results results;
Servo myservo;
void setup()
{
 Serial.begin(9600);
 irrecv.enableIRIn(); // Start the receiver
 myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}
void loop() 
{
 if (irrecv.decode(&results)) 
   {
     irrecv.resume();   // Receive the next value
   }
  if (results.value == 33441975)  // change according to your IR remote button number
    {
      myservo.write(0);
      delay(15);
    }
    if (results.value == 33446055)  // change according  to your IR remote button number
    {
      myservo.write(30);
    delay(15);
    }
    
}     


 الصفحة على الفيسبوك 


https://www.facebook.com/AEA-ابتكارات-100888548256177/

قناة على اليوتوب 


             https://www.youtube.com/channel/UCvP0QWwJDfC3gH5BEjgGUtg


             





تعليقات