By Syed Owais Chishti
ELab
Code to be compiled in Raspberry Pi terminal:
git clone git://git.drogon.net/wiringPi
cd wiringPi
git pull origin
cd wiringPi ./build
Now test wiringPi installation with
cd wiringPi ./build
sudo apt-get update
sudo apt-get install apache2 apache2-doc apache2-utils
sudo apt-get install libapache2-mod-php5 php5 php-pear php5-xcache
cd /var/www/ sudo nano switch.php
In nano window paste this code:
// (c) 2015 Syed owais chishti
$output = shell_exec('gpio mode '.$_GET['pin'].' out');
$output = shell_exec('gpio write '.$_GET['pin'].' '.$_GET['switch']);
echo $_GET['status'];
$output = shell_exec('gpio read 8');
echo "GPIO 2:".$output;
$output = shell_exec('gpio read 9');
echo "GPIO 3:".$output;
$output = shell_exec('gpio read 7');
echo "GPIO 4:".$output;
$output = shell_exec('gpio read 11');
echo "GPIO 7:".$output;
$output = shell_exec('gpio read 10');
echo "GPIO 8:".$output;
$output = shell_exec('gpio read 13');
echo "GPIO 9:".$output;
$output = shell_exec('gpio read 12');
echo "GPIO 10:".$output;
$output = shell_exec('gpio read 14');
echo "GPIO 11:".$output;
$output = shell_exec('gpio read 0');
echo "GPIO 17:".$output;
$output = shell_exec('gpio read 1');
echo "GPIO 18:".$output;
$output = shell_exec('gpio read 3');
echo "GPIO 22:".$output;
$output = shell_exec('gpio read 4');
echo "GPIO 23:".$output;
$output = shell_exec('gpio read 5');
echo "GPIO 24:".$output;
$output = shell_exec('gpio read 6');
echo "GPIO 25:".$output.;
$output = shell_exec('gpio read 2');
echo "GPIO 27:".$output;
$output = shell_exec('gpio read 15');
echo "UART TX:".$output;
$output = shell_exec('gpio read 16');
echo "UART RX:".$output;
?>
LIVE VIDEO STREAMING:
raspivid -n -ih -t 0 -rot 0 -w 1280 -h 720 -fps 15 -b 1000000 -o - | nc -lkv4 5001