Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EspaceRaspberryFrancais/33abe62b0ff7a23e8098dac7f673aa3d to your computer and use it in GitHub Desktop.
Save EspaceRaspberryFrancais/33abe62b0ff7a23e8098dac7f673aa3d to your computer and use it in GitHub Desktop.
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