Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4804

Python • Re: Script for waveshare relay module

$
0
0
Hi, I have not got my jumpers yet, so have not been able to wire up the relay. I´m hoping to get them later today. I have revised the script which I have copied below.
import RPi.GPIO as GPIO
import time
time.sleep(1)

relay_ch = 26
relay_ch = 16
relay_ch = 6

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

GPIO.setup(relay_ch1,2,3, GPIO.OUT)
GPIO.output(relay_ch1,2,3, GPIO.LOW)

time.sleep(1)

GPIO.output(relay_ch1,2,3, GPIO.HIGH)

GPIO.cleanup()


I really am a complete beginner, so I am hoping someone can put me right. I have three relays on the waveshare relay board. I would like them to all operate when the pi is turned on and to open circuit when it is turned off. My pi is being used for a jukebox, and I simply want my amplifier, led strips, and monitor to come on at the same time as the pi. I have tried to add a one second delay before they turn on, hopefully to avoid any problems. I don´t know if I need a service file?I would appreciate any help to get this script to work. I have a feeling it is not right? B.Goode !

Statistics: Posted by barrychilds — Fri Jun 28, 2024 8:07 am



Viewing all articles
Browse latest Browse all 4804

Trending Articles