Hallo,
ich verwende folgenden Sketch, habe diesen auch aus diesem Forum und er sollte funktioniernen.
Außer bei mir
Ich habe alle pins probiert, Verschiedene Jessie Versionen und alles ist aktuell Python mäßig ist alles installiert. wenn ich den Sktech ausführe kommt auch keine Fehlermedlung es passiert nichts. die LED bleibt aus.
Was kann ich noch überprüfen??
Danke
Code
import RPi.GPIO as GPIO #This line alone caused 90 minutes of frustration
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(21, GPIO.OUT) #set pin 21 to output
p = GPIO.PWM(21,50) #set the PWM on pin 21 to 50%
p.start(0) #I don’t remember what this does but trust me, you need it.
try:
while True:
for i in range (100):
p.ChangeDutyCycle(i)
time.sleep(0.02) #These last three lines are going to loop and increase the power from 1% to 100% gradually
for i in range(100):
p.ChangeDutyCycle(100-i)
time.sleep(0.02) #These three lines loop and decrease the power from 100%-1% gradually
except KeyboardInterrupt:
pass #This is supposed to stop the program if a key is hit, but it doesn’t work for us. Only ctrl^c works
p.stop()
GPIO.cleanup()
Alles anzeigen
Wenn ich den Sketch zweimal starte, kommt diese Meldung
./pwm.py:7: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(16, GPIO.OUT)
etwas passiert ja mal