نمایش نتایج: از 1 به 2 از 2

موضوع: موتور میکرو سروو H512 Tower Pro SG90

  1. #1
    مدیر گروه
    تاریخ عضویت
    Nov 2013
    محل سکونت
    ایران
    نوشته ها
    4,064

    موتور میکرو سروو H512 Tower Pro SG90

    نمونه کد آردوینو با کتابخانه سروو :
    کد:
    #include servo.h  //add '<' and '>' before and after servo.h
     
    int servoPin = 9;
     
    Servo servo;  
     
    int servoAngle = 0;   // servo position in degrees
     
    void setup()
    {
      Serial.begin(9600);  
      servo.attach(servoPin);
    }
     
     
    void loop()
    {
    //control the servo's direction and the position of the motor
    
    
       servo.write(45);      // Turn SG90 servo Left to 45 degrees
       delay(1000);          // Wait 1 second
       servo.write(90);      // Turn SG90 servo back to 90 degrees (center position)
       delay(1000);          // Wait 1 second
       servo.write(135);     // Turn SG90 servo Right to 135 degrees
       delay(1000);          // Wait 1 second
       servo.write(90);      // Turn SG90 servo back to 90 degrees (center position)
       delay(1000);
    
    
    //end control the servo's direction and the position of the motor
    
    
    
    
    //control the servo's speed  
    
    
    //if you change the delay value (from example change 50 to 10), the speed of the servo changes
      for(servoAngle = 0; servoAngle < 180; servoAngle++)  //move the micro servo from 0 degrees to 180 degrees
      {                                  
        servo.write(servoAngle);              
        delay(50);                  
      }
    
    
      for(servoAngle = 180; servoAngle > 0; servoAngle--)  //now move back the micro servo from 0 degrees to 180 degrees
      {                                
        servo.write(servoAngle);          
        delay(10);      
      }
      //end control the servo's speed  
    }

  2. #2
    مدیر گروه
    تاریخ عضویت
    Nov 2013
    محل سکونت
    ایران
    نوشته ها
    4,064
    نمونه سیم بندی اتصال سروو sg90 به برد آردوینو :
    برای دیدن سایز بزرگ روی عکس کلیک کنید

نام: Arduino-servo-motor-control_bb-e1452431548643.jpg
مشاهده: 533
حجم: 94.7 کیلو بایت

مجوز های ارسال و ویرایش

  • شما نمیتوانید موضوع جدیدی ارسال کنید
  • شما امکان ارسال پاسخ را ندارید
  • شما نمیتوانید فایل پیوست کنید.
  • شما نمیتوانید پست های خود را ویرایش کنید
  •  

SEO by vBSEO