Skip to content

Commit

Permalink
Create gpio.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH committed May 11, 2024
1 parent 3750c36 commit 4ff9525
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions hardware_interface/gpio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import RPi.GPIO as GPIO

def setup_gpio():
# Set up GPIO pins using RPi.GPIO or gpiozero

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

def set_gpio_mode(pin, mode):
# Set the mode of a GPIO pin

GPIO.setup(pin, mode)

def set_gpio_value(pin, value):
# Set the value of a GPIO pin

GPIO.output(pin, value)

def get_gpio_value(pin):
# Get the value of a GPIO pin

return GPIO.input(pin)

0 comments on commit 4ff9525

Please sign in to comment.