Outils pour utilisateurs

Outils du site


isn:2017:projetmariokart:pwm

Table des matières

Système PWM

Code test (LED)

 import RPi.GPIO as GPIO
 import time
 GPIO.setmode(GPIO.BCM)
 GPIO.setup(4, GPIO.OUT)
 LED = GPIO.PWM(4, 50)
 LED.start(0)
 try:
     while 1:
         for dc in range(0, 101, 1):
             LED.ChangeDutyCycle(dc)
             time.sleep(0.01)
         for dc in range(100, -1, -1):
             LED.ChangeDutyCycle(dc)
             time.sleep(0.01)
 except KeyboardInterrupt:
     pass
 p.stop()
 GPIO.cleanup()

Retour

isn/2017/projetmariokart/pwm.txt · Dernière modification: 2018/03/30 08:37 (modification externe)