0

I am a Python noob, and recently purchased a 2 channel relay module from sunfounder. I wired it up to my Pi, and the relay turned on and stays on. I am wondering if any one can provide my with the simplest Python code to flip the relay on and off.

Extra Info: I am connected to pins 2 (5V), 6 (Ground), and 9 (Ground) on a Raspberry Pi Model B.

I followed the instructions

8

1 Answer 1

1

First off, your pins are messed up - so you need to connect the Vcc to a 5V pin and the GND to a ground pin. Then you connect your two relays to a GPIO pin. For instance, I connected my two to GPIO 2 and 3. Then use the python scripts supplied by "skiwithpete" on YouTube, see this video Raspberry Pi: 16 Channel Relay how to with example software for automation projects.

1
  • I have taken the liberty of adding the links to which I believe you are referring to. Please correct me if I am wrong. Feb 1, 2016 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.