Last active
July 1, 2020 13:06
-
-
Save JosephRedfern/b06e96e00d4f09a1f0cadf8ebbb12e14 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
import RPi.GPIO as GPIO | |
channel = 21 | |
# GPIO setup | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(channel, GPIO.OUT) | |
app = Flask(__name__) | |
# these shouldn't really be GET, idempotency etc. | |
@app.route('/api/gate/activate') | |
def open_gate(): | |
GPIO.output(pin, GPIO.HIGH) # activate the gate | |
@app.route('/api/gate/deactivate') | |
def open_gate(): | |
GPIO.output(pin, GPIO.LOW) # deactivate the gate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment