O'Reilly logo

BeagleBone Essentials by Rodolfo Giometti

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Managing an LED in PHP

Now it's time to see how to manage our LED using the PHP language.

There are two different possibilities to do this: the first one is to use the LAMP (Linux-Apache-MySQL-PHP) system we set up in The LAMP suite section of Chapter 1, Installing the Developing System, while the second one is to use the PHP built-in web server.

The LAMP solution

This is the easiest and most classic way to implement a common web application. We just need a PHP script where we can implement our LED management. So let's start with writing some code!

In the first step, we must create a file named turn.php in the /var/www/ directory of the BeagleBone Black with the following content:

<?php # 1st part - Global defines & functions define("value_f", "/sys/class/gpio/gpio66/value"); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required