php, html , raspberry pi GPIO steuern...

in #php7 years ago

RASPBERRY_PI_B_PLUS_02.png

Der Start eines Home Automationssystems

Der start war für mich am schwierigsten. Ich hatte mit vielen Problemen zu kämpfen z.B. welchen Webserver nehme ich her und wie steuere ich mit html die einzelnen GPIO pins über meinen PC.

Meine entscheidung fiel auf "lighttpd"
---->https://www.lighttpd.net/
mich hat er mit seiner Leichtigkeit der Installation und der geringen Größe sehr überzeugt.

Installieren:
----> sudo apt-get install update && sudo apt-get install upgrade
----> sudo apt-get install lighttpd

Nach der Installation befinden sich alle Dateien wie index.html oder css.css im ordner /var/www/html.
Der Zugriff erfolgt entweder über die ip adresse vom Raspberry oder über den link http://raspberrypi/

Anschließend habe ich für jede Handlung z.B. lich an oder lich aus eine python Datei geschrieben.

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(7,GPIO.OUT)

for x in range(0,1):
GPIO.output(7,False)

Hier habe ich ein pin eingefühgt GPIO.setup(7,GPIO.OUT) = pin 7, mit GPIO.setwarnings(False) stelle ich die Warnmeldungen aus wenn z.B. der pin von einem anderen befehl benutzt wird.

Die 1 in for x range (0,1) gibt an wie oft die befehle drunter ausgeführt werden.
Und ja unten stehen dann die befehle .... verdammt habe den faden verloren.....

...

Weiter habe ich eine php Datei erstellt die dann den python skrip ausführt.

-<?php
-exec("python /var/www/html/befehle/datei.py")
-?>

Dann habe ich in meiner haupt seite ein button erstellt der dann die php seite öffnet und somit den python skrip ausführt.

-An

ja und so weiter .. irgendwie ist es zu viel für den Anfang geworden ... bitte um konstruktiver Kritik weil ich selber weis das dass was hier hingeschrieben haben nicht das wahre ist aber naja ist ja wurscht...

Sort:  

Congratulations @altron! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You published your First Post

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations @altron, you have decided to take the next big step with your first post! The Steem Network Team wishes you a great time among this awesome community.


Thumbs up for Steem Network´s strategy

The proven road to boost your personal success in this amazing Steem Network

Do you already know that awesome content will get great profits by following these simple steps, that have been worked out by experts?

Congratulations @altron! You received a personal award!

1 Year on Steemit

Click here to view your Board

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @altron! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.029
BTC 66217.53
ETH 3316.11
USDT 1.00
SBD 2.70