Go to advanced search

by dott_ing
Fri Dec 11, 2015 1:26 pm
Forum: Python
Topic: Blink LEDs python
Replies: 18
Views: 4575

Re: Blink LEDs python

I don't like doing this as I'd much rather see you try to adapt your code. But try this... import threading import time import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) # This is a list in the form (pin number, delay) LEDS = [(7, 1), (11, 2), (13, 3), (15,4)] class FlashLed(threading.Thread): def _...
by dott_ing
Fri Dec 11, 2015 12:54 pm
Forum: Python
Topic: Blink LEDs python
Replies: 18
Views: 4575

Re: Blink LEDs python

There are a few ways of doing it. Massi's suggested one which I've never used. Other ideas could be: Use the modulo operator to check whether a counter is a multiple of your desired interval (e.g. if you've got two LEDs, one flashes every 5 intervals and the other every 3 then you use the modulo op...
by dott_ing
Fri Dec 11, 2015 11:13 am
Forum: Python
Topic: Blink LEDs python
Replies: 18
Views: 4575

Re: Blink LEDs python

can anyone help me to modify the code I posted above? Thank you all
by dott_ing
Fri Dec 11, 2015 10:23 am
Forum: Python
Topic: Blink LEDs python
Replies: 18
Views: 4575

Re: Blink LEDs python

This is my code: import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setup(7, GPIO.OUT) GPIO.setup(11, GPIO.OUT) GPIO.setup(13, GPIO.OUT) GPIO.setup(15, GPIO.OUT) def activateLED(pin,delay): GPIO.output(pin, GPIO.HIGH) time.sleep(delay) GPIO.output(pin, GPIO.LOW) time.sleep(delay) retu...
by dott_ing
Fri Dec 11, 2015 9:35 am
Forum: Python
Topic: Blink LEDs python
Replies: 18
Views: 4575

Re: Blink LEDs python

elParaguayo wrote:What have you tried so far? You'll learn more if we help you with your own code rather than just give you an answer.

Is this a homework exercise?
It is for a personal project. The code I wrote only achieves a turn on the LEDs sequentially and not simultaneously.
by dott_ing
Fri Dec 11, 2015 8:52 am
Forum: Python
Topic: Blink LEDs python
Replies: 18
Views: 4575

Blink LEDs python

Hello, I have a problem that I can not find solution. I have to turn on the LEDs, with the GPIO interface, simultaneously but with different flashing frequencies using a python script. How can I do? Thank you all for answers

Go to advanced search