Modifications

Sauter à la navigation Sauter à la recherche
170 octets ajoutés ,  19 avril 2015 à 13:39
Ligne 98 : Ligne 98 :  
  <nowiki>>>> servo1 = pyb.Servo(1)</nowiki>
 
  <nowiki>>>> servo1 = pyb.Servo(1)</nowiki>
   −
To change the angle of the servo use the angle method:
+
Pour changer l'angle du servo, il faut utiliser la méthode {{fname|servo}}:
    
  <nowiki>>>> servo1.angle(45)
 
  <nowiki>>>> servo1.angle(45)
 
>>> servo1.angle(-60)</nowiki>
 
>>> servo1.angle(-60)</nowiki>
   −
The angle here is measured in degrees, and ranges from about -90 to +90, depending on the motor. Calling angle without parameters will return the current angle:
+
L'angle est mesuré en degrés et la valeur comprise entre -90 et +90 (environ, cela dépend du moteur).  
 +
 
 +
Appeler la méthode angle sans paramètre retournera l'angle actuel du moteur:
    
  <nowiki>>>> servo1.angle()
 
  <nowiki>>>> servo1.angle()
 
-60</nowiki>
 
-60</nowiki>
   −
Note that for some angles, the returned angle is not exactly the same as the angle you set, due to rounding errors in setting the pulse width.
+
{{underline|Note:}} Pour certaines valeur d'angle, la valeur retournée n'est pas exactement la même que celle utilisée pour assigner l'angle. Cela est dut aux erreurs d'arrondis lorsque la carte PyBoard calcule et assigne la longueur d'impulsion.
 +
 
 +
{{traduction}}
    
You can pass a second parameter to the {{fname|angle}} method, which specifies how long to take (in milliseconds) to reach the desired angle. For example, to take 1 second (1000 milliseconds) to go from the current position to 50 degrees, use
 
You can pass a second parameter to the {{fname|angle}} method, which specifies how long to take (in milliseconds) to reach the desired angle. For example, to take 1 second (1000 milliseconds) to go from the current position to 50 degrees, use
29 837

modifications

Menu de navigation