![]() Connect an LED with a resistor to GPIO pin 17 and GND as shown in Figure 1. To put Wiring Pi to practical use, I'll build a super-simple ![]() Next, execute the gpio readall command to view a detailed GPIO layout diagram. To make sure Wiring Pi is installed and works properly, run the gpio -v command it should return the current version of Wiring Pi along with the basic Raspberry Pi info. build command to compile and install Wiring Pi: cd wiringPi Switch to the resulting wiringPi directory and use the. Then, clone the Wiring Pi Git repository by running Start with installing the Git software using: sudo apt-get install git-core Fortunately, this process is relatively straightforward. The library is not available as a binary package, so you need to compile and install it from the source. ![]() For this solution to work, you need to install Wiring Pi on Raspberry Pi first. for working with GPIO pins and then use the library with PHP via the shell_exec() function. In the most simple case, shell_exec() can call Python scripts that perform certain tasks and control GPIO pins.Īnother approach is to deploy the Wiring Pi library This function lets you execute shell commands, so it can act as a sort of bridge between PHP and the Raspberry Pi. Probably the easiest way to use PHP with Raspberry Pi is through the shell_exec() function. Server like lighttpd using the sudo apt-get install lighttpd php5 ![]() Instead of Apache, you can install a more lightweight Installing both PHP and Apache on Raspberry Pi is a matter of running: sudo apt-get install apache2 php5 In most situations, PHP is used in tandem with a web server like Apache. Perhaps you are more familiar with writing code in PHP than Python, or maybe you just want to give another programming language a try.īefore you can start working with PHP on Raspberry Pi, you need to install PHP itself on the machine. If you've already built a PHP-based app, and you want to integrate it with Raspberry Pi, forĮxample, it makes sense to stick to PHP. ![]() You might want to use PHP on Raspberry Pi for several reasons. With a bit of work, however, you can teach Raspberry Pi to understand other languages, including PHP. Python and Scratch are by far the most popular options for programming Raspberry Pi. We show how to build a simple PHP app to control an LED. Getting started with PHP on Raspberry Pi is easy. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |