| 1 |
import time |
| 2 |
import RPi.GPIO as GPIO |
| 3 |
|
| 4 |
LED_PIN = 12 |
| 5 |
|
| 6 |
def issue_154(): |
| 7 |
|
| 8 |
count = 0 |
| 9 |
pinRef = GPIO.PWM(LED_PIN,50) |
| 10 |
while True: |
| 11 |
pinRef.start(10) |
| 12 |
time.sleep(0.05) |
| 13 |
pinRef.stop() |
| 14 |
GPIO.output(LED_PIN,0) |
| 15 |
time.sleep(0.05) |
| 16 |
count = count + 1 |
| 17 |
print count |
| 18 |
|
| 19 |
def issue_94(cycles): |
| 20 |
|
| 21 |
pwm = GPIO.PWM(LED_PIN, 1) |
| 22 |
for i in xrange(cycles): |
| 23 |
print(i) |
| 24 |
pwm.ChangeFrequency(25) |
| 25 |
pwm.start(50) |
| 26 |
time.sleep(1) |
| 27 |
pwm.stop() |
| 28 |
|
| 29 |
if __name__ == '__main__': |
| 30 |
GPIO.setmode(GPIO.BOARD) |
| 31 |
GPIO.setup(LED_PIN, GPIO.OUT) |
| 32 |
try: |
| 33 |
|
| 34 |
issue_154() |
| 35 |
finally: |
| 36 |
GPIO.cleanup() |