Jump to content

Banner.jpg.b83b14cd4142fe10848741bb2a14c66b.jpg

Astroberry Python GPIO control


maxchess

Recommended Posts

Hi,

I have Astroberry installed and I just want to control a relay to switch it briefly on and off  to trigger the momentary circuit in a garage door controller that opens & closes my roll-off roof.  I have used RPIs and relays before, but I can't find what GPIO library is installed in Astroberry and how to address it.

My basic code is:

#!/usr/bin/env python
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
GPIO.output(17, GPIO.LOW)
time.sleep(0.25)
GPIO.output(17, GPIO.HIGH)
GPIO.cleanup()

But Astroberry doesn't like the library and when I try "sudo apt-get install rpi.gpio"  it doesn't like that either saying it can't instal it because of unmet dependencies.  I think I must be using the wrong GPIO library. What should I do to open & Close a relay on Pin 17?  Any other suggestions for writing this simple script gratefully received. It is designed to run from the scheduler as the shutdown script.  

Thanks

Max

Link to comment
Share on other sites

Try "sudo apt-get install python-rpi.gpio" for python2 or "python3-rpi.gpio" for python3. You could also use pip to install the latest development version of the RPi.GPIO.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.