Metainformationen zur Seite
Dies ist eine alte Version des Dokuments!
Installieren des Lighttpdservers:
mkdir /var/www groupadd www-data adduser www-data www-data usermod -a -G www-data www-data chown -R www-data:www-data /var/www apt-get update apt-get install lighttpd
Modul um php-Dateien ausführen zu können:
apt-get install php5-cgi lighty-enable-mod fastcgi lighty-enable-mod fastcgi-php
Benutzer zur Gruppe hinzufügen:
nano /etc/group
dialout:x:20:pi,www-data
Lighttpdserver neustarten:
/etc/init.d/lighttpd restart
nano /var/www/analog
import serial
import time
import sys
delay = 0.5
comunicacion = serial.Serial('/dev/ttyAMA0', 9600)
comunicacion.close()
comunicacion.open()
#comunicacion.write(chr(0))
#time.sleep(delay)
#comunicacion.write(chr(255))
#time.sleep(delay)
comunicacion.write(chr( int(sys.argv[1]) ))
time.sleep(delay)
das Programm „analog“ ausführbar machen:
chmod +x /var/www/analog
nano /var/www/bla.php
<?php
echo 'Hallo ' . htmlspecialchars($_GET["v"]) . '!';
passthru("/usr/bin/python analog $_GET[v]");
?>
Website im Browser öffnen und Parameter v übergeben: ip-adresse/bla.php?v=230