allalone747
Posts: 11
Joined: Thu Aug 10, 2017 10:08 pm

RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Thu Aug 10, 2017 10:41 pm

Hello
good day to all, i been trying to get a python script work on the Raspberry pi 3 to communicate with the relay board ,but cannot get it to work ,what is happening is when i try launching the script, all the lights on the relay board lit up and stay on, the script shows that it is going through all the commands to the end , then it ends and the lights went out i am using the script from this you tube tutorial
https://www.youtube.com/watch?v=TFt480sxNWg

Please could someone have a look , i follow the video and cannot solve this problem , so can you help
thank you
cheers

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Fri Aug 11, 2017 5:25 am

It is a very basic relay board. Basically when the RPi sets a GPIO pin to high it will activate the relay connected to that GPIO pin.

#Setup part of the code

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(pin, GPIO.OUT) #where the word pin is you will need use the number that pin to set it as out. You will need repeat this for each GPIO pin your using

#main part of the code to use the GPIO pins to operate the Relay

GPIO.output(pin, GPIO.HIGH) #where the word pin is replace with the number of the pin to turn on relay

GPIO.output(pin, GPIO.LOW) #where the word pin is replace with the number of the pin to turn off the relay

pcmanbob
Posts: 9270
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Fri Aug 11, 2017 10:01 am

Hi.

Many of these relay boards are designed to operate with 5v input where as the pi gpio is only 3.3v .
they also work with reversed logic ie high gpio = off, low gpio = on
because of the 2 problems above you often find the relays will switch on but not switch off, I suspect you have one of these relay boards which is different to the one shown in the video.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Fri Aug 11, 2017 10:16 am

All in all you don't even need this board and connecting a relay to the that will be activated by 3.3v to the GPIO pins will do the same thing. Unless your using high power that requires a relay it is more common to use a solid state Mosfet to do the same job. see something like this https://www.sparkfun.com/products/10213

pcmanbob
Posts: 9270
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Fri Aug 11, 2017 10:38 am

OutoftheBOTS wrote:
Fri Aug 11, 2017 10:16 am
All in all you don't even need this board and connecting a relay to the that will be activated by 3.3v to the GPIO pins will do the same thing. Unless your using high power that requires a relay it is more common to use a solid state Mosfet to do the same job. see something like this https://www.sparkfun.com/products/10213
You can't drive a relay even a 3.3v one directly from the GPIO pins , GPIO has a 16mA limit on output current on a single pin most relays required more than that to operate them.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
OutoftheBOTS
Posts: 711
Joined: Tue Aug 01, 2017 10:06 am

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Fri Aug 11, 2017 9:21 pm

So you need a mosfet to operate the relay.

Either way if the project can be switched using a mosfet rather than a relay this will make it much easier. If you need to use a relay then use a mosfet to switch the relay.

There is a lot of mosfet boards around see https://www.google.com.au/search?q=mosf ... 80&bih=609

allalone747
Posts: 11
Joined: Thu Aug 10, 2017 10:08 pm

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Sun Aug 13, 2017 8:13 am

Thanks everyone for your support ,I am new to these and will try out your different suggestions , I read in that the 5v wire should be connect on the 3.3 of the Raspberry pi 3 and remove the gd from both , I haven't tried it yet but will do so as an example ,I will post the result
Cheers

User avatar
davidcoton
Posts: 4899
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Sun Aug 13, 2017 8:20 am

allalone747 wrote:
Sun Aug 13, 2017 8:13 am
I read in that the 5v wire should be connect on the 3.3 of the Raspberry pi 3 and remove the gd from both
I wouldn't try that. Although if you get it right it might work, there is far too much room for a stray ground connection that would lead to instant Pi destruction™.
You need one of the methods that (indirectly) drives the relays from the 3V3 GPIO, leaving ground as the common connection.
Alternatively, set your existing relay board aside and buy one that is designed to work with the Pi.
Signature retired

pcmanbob
Posts: 9270
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Sun Aug 13, 2017 9:50 am

allalone747 wrote:
Sun Aug 13, 2017 8:13 am
Thanks everyone for your support ,I am new to these and will try out your different suggestions , I read in that the 5v wire should be connect on the 3.3 of the Raspberry pi 3 and remove the gd from both , I haven't tried it yet but will do so as an example ,I will post the result
Cheers
If you post details of the exact relay board you have then may be we could offer you better advice there are many versions out there, some work with the pi some dont and required interface circuits between the pi and the relay board, but without know exactly which board you have we cant help.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

allalone747
Posts: 11
Joined: Thu Aug 10, 2017 10:08 pm

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Sun Aug 13, 2017 5:09 pm

Hello thank you for replies, i will wait for your findings on this relay board i buy it off E bay this is the link , it say nothing on the board only 16 Channel 12V relay module
Hope you can help


http://www.ebay.co.uk/itm/5V-or-12V-1-2 ... 2749.l2649


cheers

pcmanbob
Posts: 9270
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Mon Aug 14, 2017 9:36 am

Well you suppliers provides no supporting documentation at all, so it going to be down to you to figure out the operation of this board.

First thing you need to do is connect the external power source to these terminals.

Image
depending on which board you purchased it will require 5Vdc or 12Vdc.

now using a meter set to volts connect you probes to the terminals marked 5v and gnd on the input pin block

Image

if you get a reading of 5v and I suspect you might then you cant drive this relay board directly from the gpio.
So if you have a reading of 5v then try connecting one of the pins to gnd pin and see if the relay activates, if it does not then try connecting the same number pin to the 5v pin and see if it activates.

once you know how it works come back and tell us the results and we can help with the interfacing of the relay board to your pi.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

allalone747
Posts: 11
Joined: Thu Aug 10, 2017 10:08 pm

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Mon Aug 14, 2017 1:55 pm

pcmanbob wrote:
Mon Aug 14, 2017 9:36 am
Well you suppliers provides no supporting documentation at all, so it going to be down to you to figure out the operation of this board.

First thing you need to do is connect the external power source to these terminals.

Image
depending on which board you purchased it will require 5Vdc or 12Vdc.

now using a meter set to volts connect you probes to the terminals marked 5v and gnd on the input pin block

Image

if you get a reading of 5v and I suspect you might then you cant drive this relay board directly from the gpio.
So if you have a reading of 5v then try connecting one of the pins to gnd pin and see if the relay activates, if it does not then try connecting the same number pin to the 5v pin and see if it activates.

once you know how it works come back and tell us the results and we can help with the interfacing of the relay board to your pi.
Hello I did as you mention so the result 5v and gnd return 5 v. I then connect pin 13 to gnd and I had light on 13 I then connect pin 13 and 5v this time there is nothing showing the relay board is 12v I buy a 12v ac/dc adaptor showing 12v 6A OUTPUT
Thank you

pcmanbob
Posts: 9270
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Mon Aug 14, 2017 3:03 pm

OK so from your testing we know that you cant drive this relay board from the gpio directly because its using 5v to operate the driver circuits for the relays and if we connected this to the gpio directly we risk damaging your pi.

So there are 2 ways to do this build individual transistor drive circuits for each relay ok if you only have a board with say 1 or 2 relays but as you have 16 I would suggest you use 2 x ULN2803A chips because you can drive the chips directly from the gpio and they will drive your relay board at 5v and so protect you pi from any damage.

But its up to you if you let me know which way you want to do it I will draw up the circuit explaining how to connect it.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

allalone747
Posts: 11
Joined: Thu Aug 10, 2017 10:08 pm

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Mon Aug 14, 2017 5:59 pm

pcmanbob wrote:
Mon Aug 14, 2017 3:03 pm
OK so from your testing we know that you cant drive this relay board from the gpio directly because its using 5v to operate the driver circuits for the relays and if we connected this to the gpio directly we risk damaging your pi.

So there are 2 ways to do this build individual transistor drive circuits for each relay ok if you only have a board with say 1 or 2 relays but as you have 16 I would suggest you use 2 x ULN2803A chips because you can drive the chips directly from the gpio and they will drive your relay board at 5v and so protect you pi from any damage.

But its up to you if you let me know which way you want to do it I will draw up the circuit explaining how to connect it.
Hello thanks , I would prefer the 2 option , this link is from Amazon , will this unit do the job , I will order them ,I will be obliged if you can draw the circuit for me , I will send the results as soon I get the parts ,thank for your valued time.
Cheers

https://www.amazon.co.uk/ULN2803A-Darli ... s=Uln2803a

pcmanbob
Posts: 9270
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Mon Aug 14, 2017 6:28 pm

Yes that is exactly what you need 2 of them.

Image

This is the chip pin out as you can see it has 8 inputs and 8 outputs , so pin 1 input controls pin 18 output and so on, making it easy to connect up.
the only other connections are ground and 5v

Image

So this is how you connect it ( only showing all the connection's on one chip or diagram would be to messy )

So you connect the gpio pins to the inputs I have show some examples but you can use any order you like, I suggest you don't use gpio's 2,3,4,14 & 15 as they have other uses as well and sone are active during boot or may have been activated at some point by you.

The output pins on each chip are connected to the pins marked 2 to 16 on your relay board.
and finally you need to connect 5v and ground from your relay board to the chips and a ground pin on the gpio to the ground of the chips.

One all the connections are made you just need to make each gpio pin you have used, high to turn on the relay., and you should have a working 16 channel relay board connected safely to your pi.

One word of advice if you are going to be soldering this to strip board I would suggest using sockets for the chips to prevent damage due to heating while soldering.

let me know you you get on, any questions please ask.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

allalone747
Posts: 11
Joined: Thu Aug 10, 2017 10:08 pm

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Tue Aug 15, 2017 1:49 pm

Hello
Thanks for your ,diagram i now wait for the items to come to hand, then i will set it and and report the results
I am grateful to you , Thanks
cheers
:)

allalone747
Posts: 11
Joined: Thu Aug 10, 2017 10:08 pm

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Wed Aug 23, 2017 8:19 pm

pcmanbob wrote:
Mon Aug 14, 2017 6:28 pm
Yes that is exactly what you need 2 of them.

Image

This is the chip pin out as you can see it has 8 inputs and 8 outputs , so pin 1 input controls pin 18 output and so on, making it easy to connect up.
the only other connections are ground and 5v

Image

So this is how you connect it ( only showing all the connection's on one chip or diagram would be to messy )

So you connect the gpio pins to the inputs I have show some examples but you can use any order you like, I suggest you don't use gpio's 2,3,4,14 & 15 as they have other uses as well and sone are active during boot or may have been activated at some point by you.

The output pins on each chip are connected to the pins marked 2 to 16 on your relay board.
and finally you need to connect 5v and ground from your relay board to the chips and a ground pin on the gpio to the ground of the chips.

One all the connections are made you just need to make each gpio pin you have used, high to turn on the relay., and you should have a working 16 channel relay board connected safely to your pi.

One word of advice if you are going to be soldering this to strip board I would suggest using sockets for the chips to prevent damage due to heating while soldering.

let me know you you get on, any questions please ask.
Hello
A very good evening to you, i now receive all the hardware i think i needed, but after following your instructions,unfortunately things did not work for me, i am using a script created by https://www.youtube.com/user/skiwithpete i attached it , i just change the GPIO to match your layout , i cannot attach the file, would you have a script which i can use to test this layout, cheers

pcmanbob
Posts: 9270
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Thu Aug 24, 2017 12:05 pm

I can only write a script for the first chip as I don't know what gpio numbers you used for the second chip.
So I have kept it simple so you can just add the relevant numbers to test all of your replays or just change the numbering of my script to do the second chip.

Code: Select all

import RPi.GPIO as GPIO
import time


GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

GPIO.setup(18, GPIO.OUT)
GPIO.setup(23, GPIO.OUT)
GPIO.setup(24, GPIO.OUT)
GPIO.setup(25, GPIO.OUT)
GPIO.setup(8, GPIO.OUT)
GPIO.setup(7, GPIO.OUT)
GPIO.setup(12, GPIO.OUT)
GPIO.setup(16, GPIO.OUT)

GPIO.output(18, GPIO.HIGH)
time.sleep(5)
GPIO.output(18, GPIO.LOW)
time.sleep(5)

GPIO.output(23, GPIO.HIGH)
time.sleep(5)
GPIO.output(23, GPIO.LOW)
time.sleep(5)

GPIO.output(24, GPIO.HIGH)
time.sleep(5)
GPIO.output(24, GPIO.LOW)
time.sleep(5)

GPIO.output(25, GPIO.HIGH)
time.sleep(5)
GPIO.output(25, GPIO.LOW)
time.sleep(5)

GPIO.output(8, GPIO.HIGH)
time.sleep(5)
GPIO.output(8, GPIO.LOW)
time.sleep(5)

GPIO.output(7, GPIO.HIGH)
time.sleep(5)
GPIO.output(7, GPIO.LOW)
time.sleep(5)

GPIO.output(12, GPIO.HIGH)
time.sleep(5)
GPIO.output(12, GPIO.LOW)
time.sleep(5)

GPIO.output(16, GPIO.HIGH)
time.sleep(5)
GPIO.output(16, GPIO.LOW)
time.sleep(5)

To post code all you need to do is click on the code button on top of posting window and paste your code between the 2 code tags.

any way hope me code helps
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

allalone747
Posts: 11
Joined: Thu Aug 10, 2017 10:08 pm

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Fri Aug 25, 2017 6:35 am

pcmanbob wrote:
Mon Aug 14, 2017 6:28 pm
Yes that is exactly what you need 2 of them.

Image

This is the chip pin out as you can see it has 8 inputs and 8 outputs , so pin 1 input controls pin 18 output and so on, making it easy to connect up.
the only other connections are ground and 5v

Image

So this is how you connect it ( only showing all the connection's on one chip or diagram would be to messy )

So you connect the gpio pins to the inputs I have show some examples but you can use any order you like, I suggest you don't use gpio's 2,3,4,14 & 15 as they have other uses as well and sone are active during boot or may have been activated at some point by you.

The output pins on each chip are connected to the pins marked 2 to 16 on your relay board.
and finally you need to connect 5v and ground from your relay board to the chips and a ground pin on the gpio to the ground of the chips.

One all the connections are made you just need to make each gpio pin you have used, high to turn on the relay., and you should have a working 16 channel relay board connected safely to your pi.

One word of advice if you are going to be soldering this to strip board I would suggest using sockets for the chips to prevent damage due to heating while soldering.

let me know you you get on, any questions please ask.
Hello good day to you , thanks for replying it seems we are in a time warp here presently my time is 0721 am Friday morning Greenwich mean time , anyway firstly I am using the Raspberry Pi 3 , you suggested that I don't use gpio pins 2,3,4,14,15 , but this pi 3 don't have the 14,15 , therefore I follow your diagram and try using gpio pins 18,23,24,25,8,7,12,16,20,21,26,19,13,6,5,11, in that order the other script , the gpio pins that he use are gpio 2,3,4,17,27,22,10,9,11,5,6,13,19,26,21,20,
Following your advice I wire up mine to the first pin out ie 18,23,24,
Cheers

pcmanbob
Posts: 9270
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Fri Aug 25, 2017 8:31 am

Hi.

I don't quite understand what you are saying.
but all pi's have gpio 14 and 15
Image

So you say you are using 18,23,24,25,8,7,12,16,20,21,26,19,13,6,5,11 if that is gpio numbers then that's fine you just need to change my program to add the numbers 20,21,26,19,13,6,5,11

then when you run the program it should turn each relay on for 5 seconds.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

allalone747
Posts: 11
Joined: Thu Aug 10, 2017 10:08 pm

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Tue Aug 29, 2017 7:03 am

Hello
Good morning , I had to show and lend a helping hand with the bank holiday so only could reply now, and yes sorry for not seeing the GLIP14 and GPIO15 reason is the download diagram that I had ,it show them as UARTO TX AND UARTO RX sorry about that I will do my connections again
Cheers :D

pcmanbob
Posts: 9270
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Tue Aug 29, 2017 9:18 am

allalone747 wrote:
Tue Aug 29, 2017 7:03 am
Hello
Good morning , I had to show and lend a helping hand with the bank holiday so only could reply now, and yes sorry for not seeing the GLIP14 and GPIO15 reason is the download diagram that I had ,it show them as UARTO TX AND UARTO RX sorry about that I will do my connections again
Cheers :D
But according to your post you used gpio's 18,23,24,25,8,7,12,16,20,21,26,19,13,6,5,11 now if these are gpio numbers then you are not using any of the gpio's to suggest you don't use so you should be OK.

remember we are talking gpio numbers here not pin numbers.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

allalone747
Posts: 11
Joined: Thu Aug 10, 2017 10:08 pm

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Tue Sep 05, 2017 9:19 pm

Hello
Good evening, i am unable to add attachment so i just copy the Python file i am trying to execute, my problem is when i run the file it turn these lights on
the board start on 1,3,5, 9,11,13,15,2,6,8,10,12,14, 16. it clean up ,but 4 ,7 did not come on, shouldn't they come on in order from 1-16 . or is the order of this code lay out incorrectly
Thank you ;)

import RPi.GPIO as GPIO
import time


GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

GPIO.setup(18, GPIO.OUT)
GPIO.setup(23, GPIO.OUT)
GPIO.setup(24, GPIO.OUT)
GPIO.setup(25, GPIO.OUT)
GPIO.setup(8, GPIO.OUT)
GPIO.setup(7, GPIO.OUT)
GPIO.setup(12, GPIO.OUT)
GPIO.setup(16, GPIO.OUT)
GPIO.setup(20,GPIO.OUT)
GPIO.setup(21,GPIO.OUT)
GPIO.setup(26,GPIO.OUT)
GPIO.setup(19,GPIO.OUT)
GPIO.setup(13,GPIO.OUT)
GPIO.setup(6,GPIO.OUT)
GPIO.setup(5,GPIO.OUT)
GPIO.setup(11,GPIO.OUT)

GPIO.output(18, GPIO.HIGH)
time.sleep(5)
GPIO.output(18, GPIO.LOW)
time.sleep(5)

GPIO.output(23, GPIO.HIGH)
time.sleep(5)
GPIO.output(23, GPIO.LOW)
time.sleep(5)

GPIO.output(24, GPIO.HIGH)
time.sleep(5)
GPIO.output(24, GPIO.LOW)
time.sleep(5)

GPIO.output(25, GPIO.HIGH)
time.sleep(5)
GPIO.output(25, GPIO.LOW)
time.sleep(5)

GPIO.output(8, GPIO.HIGH)
time.sleep(5)
GPIO.output(8, GPIO.LOW)
time.sleep(5)

GPIO.output(7, GPIO.HIGH)
time.sleep(5)
GPIO.output(7, GPIO.LOW)
time.sleep(5)

GPIO.output(12, GPIO.HIGH)
time.sleep(5)
GPIO.output(12, GPIO.LOW)
time.sleep(5)

GPIO.output(16, GPIO.HIGH)
time.sleep(5)
GPIO.output(16, GPIO.LOW)
time.sleep(5)

GPIO.output(20, GPIO.HIGH)
time.sleep(5)
GPIO.output(20, GPIO.LOW)
time.sleep(5)

GPIO.output(21, GPIO.HIGH)
time.sleep(5)
GPIO.output(21, GPIO.LOW)
time.sleep(5)

GPIO.output(26, GPIO.HIGH)
time.sleep(5)
GPIO.output(26, GPIO.LOW)
time.sleep(5)

GPIO.output(19, GPIO.HIGH)
time.sleep(5)
GPIO.output(19, GPIO.LOW)
time.sleep(5)

GPIO.output(13, GPIO.HIGH)
time.sleep(5)
GPIO.output(13, GPIO.LOW)
time.sleep(5)

GPIO.output(6, GPIO.HIGH)
time.sleep(5)
GPIO.output(6, GPIO.LOW)
time.sleep(5)

GPIO.output(5, GPIO.HIGH)
time.sleep(5)
GPIO.output(5, GPIO.LOW)
time.sleep(5)

GPIO.output(11, GPIO.HIGH)
time.sleep(5)
GPIO.output(11, GPIO.LOW)
time.sleep(5)
GPIO.cleanup()

pcmanbob
Posts: 9270
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Wed Sep 06, 2017 9:13 am

The order is set by the order that you have in your program, if you want the relays to activate in the order 1-16 the you need to arrange the gpio numbering so that the gpio's are switched in the correct order.

as for 4 & 7 not coming on which gpio's are they connected to ? have you also checked the wiring ?

it might be a good idea for you to post a list showing which gpios are connected to which chip input pins and which chip output pins are connected to which relays.

remember I cant see your pi so I can only work from the information you supply.
Last edited by pcmanbob on Wed Sep 06, 2017 10:21 am, edited 1 time in total.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
rpiMike
Posts: 1327
Joined: Fri Aug 10, 2012 12:38 pm
Location: Cumbria, UK

Re: RASPBERRY PI 3 and 16 RELAY MODULE WIRING

Wed Sep 06, 2017 9:49 am

Simplified code, change the order in the iolist if required :

Code: Select all

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

iolist = [18,23,24,25,8,7,12,16,20,21,26,19,13,6,5,11]

for io in iolist:
    GPIO.setup(io,GPIO.OUT)

for io in iolist:
    print(io)
    GPIO.output(io, GPIO.HIGH)
    time.sleep(5)
    GPIO.output(io, GPIO.LOW)
    time.sleep(5)
    
GPIO.cleanup()

Return to “General discussion”