nicholab Posted August 5, 2021 Posted August 5, 2021 How would you do this? I need to take an input from a Gpio pin on a pi and then send an output to another GPIO pin. I have tried using openhapian and I can’t see how you link GPIO output up. Would I better using python under a standard OS? Thanks
dhicks Posted August 5, 2021 Posted August 5, 2021 Would I better using python under a standard OS? You are talking about openHABian, an OS image for the Raspberry Pi available at: https://www.openhab.org/ Sorry, I'm not familier with openHABian at all. By the looks of things, it provides a web-based interface for you to use from a separate device. I'm guessing that interface includes some way for you to place executable code of some sort on the device, does that sound right? If you were doing this on Raspian, you would connect to the Raspberry Pi, start up a command line interface, make sure you had the Python GPIO libraries installed and start writing code to read / write values to pins. I'm guessing openHABian might well include Python somewhere, it's probably just a case of figuring out how to add and then run scripts.
dhicks Posted August 5, 2021 Posted August 5, 2021 I'm guessing openHABian might well include Python somewhere, it's probably just a case of figuring out how to add and then run scripts. Oh, I see: https://www.openhab.org/docs/installation/openhabian.html openHABian installs on top of Debian / Raspbian, so you can still log in to your Raspberry Pi via SSH or by connecting up a screen and keyboard and start writing whatever Python code you want. I'm guessing you might be aiming to integrate with some existing feature, though, yes?
mavhc Posted August 5, 2021 Posted August 5, 2021 In python something like: from gpiozero import Button from signal import pause def activateOutput(): output.on() def deactivateOutput(): output.off() input = Button(17, pull_up=False)) output = DigitalOutputDevice(18,active_high=True) input.when_pressed = activateOutput intput.when_released = deactivateOutput print("Ready") pause() 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now