Archived
1
0
This repository has been archived on 2025-04-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
garden/automatic/input.py
2021-11-12 15:23:57 -05:00

33 lines
765 B
Python

#! env/bin/python3
import RPi.GPIO as GPIO
import time
from datetime import datetime
def get_pin_input():
# Pin Assignments
PB1_BCM = 4 # Green
PB2_BCM = 27 # Yellow
PB3_BCM = 13 # Blue
RELAY1_PIN = 26 # Water Pump
RELAY2_PIN = 20 # Unassigned
RELAY3_PIN = 21 # Lamp
# Get current time.
now = datetime.now()
hour = now.hour
minute = now.minute
# Define alias variables for input devices.
inputs = {
'green_button' : GPIO.input(PB1_BCM),
'yellow_button' : GPIO.input(PB2_BCM),
'blue_button' : GPIO.input(PB3_BCM),
'pump' : GPIO.input(RELAY1_PIN),
'lamp' : GPIO.input(RELAY3_PIN),
'hour' : hour,
'minute' : minute,
}
return inputs