Modifications

Sauter à la navigation Sauter à la recherche
Ligne 62 : Ligne 62 :  
myMotor = mh.getMotor(3)
 
myMotor = mh.getMotor(3)
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
DC motors are simple beasts, you can basically only set the speed and direction.
 +
 +
== Fixer la vitesse du moteur ==
 +
To set the speed, call '''setSpeed(speed)''' where speed varies from 0 (off) to 255 (maximum!). This is the PWM duty cycle of the motor
 +
 +
<syntaxhighlight lang="python">
 +
# set the speed to start, from 0 (off) to 255 (max speed)
 +
myMotor.setSpeed(150)
 +
</syntaxhighlight>
 +
 +
== Fixer le sens de rotation ==
 +
To set the direction, call '''run(direction)''' where direction is a constant from one of the following:
    
{{Rasp-Hat-Moteur-TRAILER}}
 
{{Rasp-Hat-Moteur-TRAILER}}
29 917

modifications

Menu de navigation