Download this file
37 lines (32 with data), 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 | import time
import RPi.GPIO as GPIO
LED_PIN = 12
def issue_154():
# fails with led off at around 400
count = 0
pinRef = GPIO.PWM(LED_PIN,50) # create new PWM instance
while True:
pinRef.start(10) # update PWM value
time.sleep(0.05)
pinRef.stop()
GPIO.output(LED_PIN,0)
time.sleep(0.05)
count = count + 1
print count
def issue_94(cycles):
# led flickers. Bug = LED stays off at around cycle 400
pwm = GPIO.PWM(LED_PIN, 1)
for i in xrange(cycles):
print(i)
pwm.ChangeFrequency(25)
pwm.start(50)
time.sleep(1)
pwm.stop()
if __name__ == '__main__':
GPIO.setmode(GPIO.BOARD)
GPIO.setup(LED_PIN, GPIO.OUT)
try:
# issue_94(1000)
issue_154()
finally:
GPIO.cleanup()
|
×
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.