Last active
August 22, 2019 15:59
-
-
Save EspaceRaspberryFrancais/33abe62b0ff7a23e8098dac7f673aa3d to your computer and use it in GitHub Desktop.
This file contains 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 time import sleep | |
from flask import Flask | |
import RPi.GPIO as GPIO | |
relais = 22 | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setup(relais, GPIO.OUT) | |
GPIO.output(relais, GPIO.HIGH) | |
app = Flask(__name__) | |
@app.route('/') | |
def index(): | |
return 'Hello world' | |
@app.route('/ouvrir') | |
def ouvrirPortail(): | |
GPIO.output(relais, GPIO.LOW) | |
sleep(0.5) | |
GPIO.output(relais, GPIO.HIGH) | |
return "Portail ouvert !" | |
app.run(debug=True, host='0.0.0.0', port=5000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment