Go to advanced search

by MizInIA
Tue Feb 14, 2017 11:42 am
Forum: Python
Topic: Code question
Replies: 3
Views: 890

Re: Code question

scotty101 wrote:Just a guess but by doing `gpiozero.LED(17).on()` you are re-instantiating/re-configuring the LED pin each time.

All of the examples use the method in your first code snippet. Use that one.
That makes sense. Thank you.
by MizInIA
Tue Feb 14, 2017 2:57 am
Forum: Python
Topic: Code question
Replies: 3
Views: 890

Code question

Why does the following code taken from an example work ? import gpiozero import time red = gpiozero.LED(17) while True: red.on() time.sleep(1) red.off() time.sleep(1) But this does not keep the led on for 1 second import gpiozero import time while True: gpiozero.LED(17).on() time.sleep(1) gpiozero.L...

Go to advanced search