Also ich habe folgende Codes Die ich gerne auf Meinen RPi 4 spielen würde und dort laufen geht da alles glatt eurer Meinung nach ?
(also ich rufe über das html das php auf und von dort aus das Pythonauf, ist und bleibt alles lokal)
Also würde des so gehen auch das sich des gegenseitig aufruft ?
Danke schonmal für alle Antworten
PHP
HTML QUELLCODE
<div class="tableform">
<div class="placeholder12">
<a href="C:\project RPi 4 decission trainer\php\runphyton(1).php"><img src="C:\project RPi 4 decission trainer\images\Ecken Bilder\all.jpg" height="100px" width="100px"> <!--alle--></a>
</div>
<div class="placeholder12">
<a href="#"><img src="C:\project RPi 4 decission trainer\images\Ecken Bilder\OR.jpg" height="100px" width="100px"> <!--rechts Oben--></a>
</div>
<div class="placeholder12">
<a href="#"><img src="C:\project RPi 4 decission trainer\images\Ecken Bilder\OL.jpg" height="100px" width="100px"> <!--links Oben--></a>
</div>
<div class="placeholder12">
<a href="#"><img src="C:\project RPi 4 decission trainer\images\Ecken Bilder\UR.jpg" height="100px" width="100px"> <!--rechts Unten--></a>
</div>
</div>
<div class="tableform">
<div class="placeholder12">
<a href="#"><img src="C:\project RPi 4 decission trainer\images\Ecken Bilder\VLTR.jpg" height="100px" width="100px"> <!--versetzt links Oben--></a>
</div>
<div class="placeholder12">
<a href="#"><img src="C:\project RPi 4 decission trainer\images\Ecken Bilder\VRTL.jpg" height="100px" width="100px"> <!--versetzt rechts Oben--></a>
</div>
<div class="placeholder12">
<a href="#"><img src="C:\project RPi 4 decission trainer\images\Ecken Bilder\UL.jpg" height="100px" width="100px"> <!--links Unten--></a>
</div>
</div>
</body>
</html>
PHP QUELLCODE
<?php
$output = array();
exec("C:\project RPi 4 decission trainer\Phyton\edition(1).py", $output);
var_dump($output);
?>
PYTHON QUELLCODE
# Verzögerungs Einstellung (in Sekunden)
verzoegerung = 1
# Ecken die im Programm angesprochen werden
bedienteecken = "alle"
# Pin-Variabelen Definition
lu = 4 # links unten
lo = 5 # links oben
ru = 6 # rechts unten
ro = 12 # rechts oben
BMelder = 13 # Bewegungsmelder IN
kontroll = 16 # Kontrollleuchte
# allgemeiner Bibliotheken-import
import time
import random
# import für GPIO Pins
import RPi.GPIO as GPIO
# config. Pins über GPIO-Nummer ansteuern
GPIO.setmode(GPIO.BCM)
# OUT_Pin konfiguration
GPIO.setup(lu, GPIO.OUT) # links unten
GPIO.setup(lo, GPIO.OUT) # links oben
GPIO.setup(ru, GPIO.OUT) # rechts unten
GPIO.setup(ro, GPIO.OUT) # rechts oben
GPIO.setup(kontroll, GPIO.OUT) # Kontrollleuchte
# IN-Pin konfiguration
GPIO.setup(BMelder, GPIO.IN) # Bewegungsmelder IN
# Variabelen Definition
bewegungsstatus = 0
#Starvorgang
print("Startvorgang...")
time.sleep(0,25)
print(bedienteecken)
print("Kontrollieren sie ob alle LEDs leuchten.")
GPIO.output(lu, GPIO.HIGH)
GPIO.output(lo, GPIO.HIGH)
GPIO.output(ru, GPIO.HIGH)
GPIO.output(ro, GPIO.HIGH)
time.sleep(0,5)
GPIO.output(lu, GPIO.LOW)
GPIO.output(lo, GPIO.LOW)
GPIO.output(ru, GPIO.LOW)
GPIO.output(ro, GPIO.LOW)
time.sleep(0,5)
GPIO.output(lu, GPIO.HIGH)
GPIO.output(lo, GPIO.HIGH)
GPIO.output(ru, GPIO.HIGH)
GPIO.output(ro, GPIO.HIGH)
time.sleep(1)
GPIO.output(lu, GPIO.LOW)
GPIO.output(lo, GPIO.LOW)
GPIO.output(ru, GPIO.LOW)
GPIO.output(ro, GPIO.LOW)
print("Starvorgang beendet...")
# Programm
# goto Anker
start:
# einlesen Bewegungsmelder
bewegungsstatus = GPIO.input(24)
# Zufalls Generator
x = randint(1, 4)
# Übertragung auf LED
if bewegungsstatus == 1:
if x == 1:
time.sleep(verzoegerung)
GPIO.output(lu, GPIO.HIGH)
time.sleep(1,5)
goto start
GPIO.output(lu, GPIO.LOW)
elif x == 2:
time.sleep(verzoegerung)
GPIO.output(lo, GPIO.HIGH)
time.sleep(1,5)
GPIO.output(lu, GPIO.LOW)
goto start
elif x == 3:
time.sleep(verzoegerung)
GPIO.output(ru, GPIO.HIGH)
time.sleep(1,5)
GPIO.output(lu, GPIO.LOW)
goto start
elif x == 4:
time.sleep(verzoegerung)
GPIO.output(ro, GPIO.HIGH)
time.sleep(1,5)
GPIO.output(lu, GPIO.LOW)
goto start
else:
goto start
Display More