p 14
from time import sleep attendre suivant la durée importée
Set everything up and set 2A to low. Tout paramétrer et mettre 2A à Bas
Set 1A to HIGH and Enable to HIGH to start the motor and let it run for 5 seconds. Mettre 1A à HIGH et Enable à HIGH pour démarrer le moteur et le laisser tourner 5 secondes.
Stop the motor by setting the Enable to LOW, sleep for 2 seconds, then run GPIO.cleanup(). Arrêter le moteur en mettant Enable à LOW, attendre 2 secondes, puis lancer GPIO.cleanup().
The first part of the program will be used in the next one. La première partie du programme sera utilisée dans le prochain.
___
p15
from time import sleep attendre suivant la durée importée
As I stated earlier, the above code is pretty much the same thing as we started with in dcmotor1.py. Comme expliqué précédemment, le code ci-dessus est très proche de celui du début de dcmotor1.py.
We are setting pin 23 to be a PWM Output line with 40% duty cycle (on 40% of the time and off 60% of the time. Nous déclarons le picot 23 comme une ligne de sortie PWM avec un rapport cyclique de 40 % (allumé pendant 40 % du temps et éteint pendant 60 %).
We start the motor by setting the enable to High and setting the Duty Cycle to 70. The motor will run for 5 seconds. Nous démarrons le moteur en plaçant Enable à HIGH et en réglant le rapport cyclique à 70 %. Le moteur tournera pendant 5 secondes.
Now, we stop the motor by setting enable to low. Maintenant, nous arrêtons le moteur en mettant Enable à LOW.
We now set the motor to reverse (pin 23 to low and starting the PWM duty cycle to 50% and run for 5 seconds… Nous inversons le sens de rotation du moteur (picot 23 à LOW et démarrage avec un rapport cyclique de 50 %) et tournons pendant 5 secondes…