From e45f9d0304fd3ae12d42410289c14e013c8c4848 Mon Sep 17 00:00:00 2001 From: akdag <cem.akdag@student.reutlingen-university.de> Date: Mon, 28 Jun 2021 16:21:35 +0200 Subject: [PATCH] app.py updated with gpio pins access --- backend/app.py | 14 ++++++++++++-- backend/requirements.txt | Bin 758 -> 792 bytes 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/backend/app.py b/backend/app.py index 5269776..ede3099 100644 --- a/backend/app.py +++ b/backend/app.py @@ -2,6 +2,8 @@ import os import json import time +import RPi.GPIO as GPIO + from flask import Flask, request, jsonify, abort from flask_cors import CORS @@ -47,11 +49,19 @@ def create_app(test_config=None): if lamp_id == 1: # Leuchte 1 für Reaktion "Frage" (BLAU) - # activate GPIO pins + + # set GPIO pins, requesting pins bei the board numbers (1-40) + GPIO.setmode(GPIO.BOARD) + GPIO.setup(11,GPIO.OUT) + GPIO.output(11,GPIO.LOW) + # activate GPIO pins + GPIO.output(11,GPIO.HIGH) time.sleep(5) - # dectivate GPIO pins + # deactivate GPIO pins + GPIO.output(11,GPIO.LOW) + GPIO.cleanup() if lamp_id == 2: # Leuchte 2 für Reaktion "Daumen hoch" (GRÜN) diff --git a/backend/requirements.txt b/backend/requirements.txt index fcd934a15747d2c3318dbd090b5090bef5ae15ca..65aec1b0bc0b6782afc318455a5d7982241a3969 100644 GIT binary patch delta 41 rcmeyyI)iOP4U=pTLjXf2gC2uBkoIKoXRrlA10dfVhz%x}Gt~nC!n_DY delta 11 ScmbQi_KkHz4b$X#OjQ6J0|a#d -- GitLab