{"id":3397,"date":"2020-10-08T19:00:07","date_gmt":"2020-10-08T17:00:07","guid":{"rendered":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/?p=3397"},"modified":"2022-12-04T11:43:17","modified_gmt":"2022-12-04T10:43:17","slug":"controlling-raspberry-pi-gpio-pins-from-script","status":"publish","type":"post","link":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/","title":{"rendered":"Controlling Raspberry Pi GPIO Pins from Script"},"content":{"rendered":"\n<p class=\"has-medium-font-size wp-block-paragraph\">We will learn, in this guide, to use a Bash script, therefore, without using a traditional programming language, to operate LEDs using the Raspberry GPIO pin control.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_89 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">In questo articolo:<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#Required_material\" >1. Required material<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#Fixing_the_traffic_light\" >Fixing the traffic light<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#Operating_system_configuration\" >3. Operating system configuration<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#Dependency_installation\" >4. Dependency installation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#Download_the_sample_code\" >Download the sample code<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#Access_to_GPIO_pins_from_Bash_scripts\" >Access to GPIO pins from Bash scripts<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#Running_the_script\" >7. Running the script<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#How_does_it_work\" >How does it work<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#Export_of_pins\" >Export of pins<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#Setting_the_direction_of_the_GPIO_pins\" >10. Setting the direction of the GPIO pins<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#Lights_on_and_off\" >Lights on and off<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#Deactivation_of_everything_on_exit\" >12. Deactivation of everything on exit<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#The_main_loop\" >The main loop<\/a><\/li><\/ul><\/nav><\/div>\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Required_material\"><\/span><strong>Required material<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">First, but it is well established that it is, we need a <a href=\"https:\/\/www.adafruit.com\/products\/3055\">Raspberry Pi<\/a> (I will use the Pi 3 Model B, but any model with GPIO pins will work just fine &#8211; in case you want to use a Raspberry Pi Zero you will need to do some soldering). I assume you have at least a Pi 2 or 3 with 40 pins;<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">A <a href=\"https:\/\/www.adafruit.com\/products\/1995\">power supply<\/a> for your Pi, usually already supplied in the box;<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">A case is usually recommended to protect the Raspberry Pi (although you will have to leave the lid slightly raised to expose the GPIO pins to connect the LEDs);<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><a href=\"https:\/\/www.adafruit.com\/products\/102\">A Micro SD card<\/a> on which to install the operating system (or use the <a href=\"https:\/\/www.adafruit.com\/product\/3259\">operating system pre-installed<\/a> on the MicroSD already supplied);<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">A set of <a href=\"http:\/\/lowvoltagelabs.com\/products\/pi-traffic\/\">led traffic lights from Low Voltage Labs<\/a>;<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">A USB keyboard to configure and program the Raspberry;<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">An HDMI monitor to connect to the Raspberry;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Fixing_the_traffic_light\"><\/span><strong><strong>Fixing the traffic light<\/strong><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The traffic lights from Low Voltage Labs connect to the Raspberry Pi using four pins. One of these must necessarily be connected to the ground, the other three are 3 pins of the GPIO used to control each single LED.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/700\/1*IgPAeEPot_6y2TZKknBQsA.jpeg\" alt=\"controllo dei pin GPIO\" width=\"700\" height=\"525\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Before turning on the Raspberry, connect the traffic light so that the pins connect to the GPIO pins highlighted in red (see figure):<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/700\/1*hpWauYmkDz2ha955KmHWMw.png\" alt=\"controllo dei pin GPIO\" width=\"700\" height=\"217\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">A simple way to make sure you have it correctly connected is to identify the row of GPIO pins to use, then, while looking at the Raspberry with the USB ports at the bottom, count 8 pins and connect the traffic light exactly as in the figure).<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/700\/1*Ox6cgWB_gyDwpLDw9sQLfw.jpeg\" alt=\"controllo dei pin GPIO\" width=\"525\" height=\"394\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/700\/1*vNezgHN-T0ENc5ydmeEiEA.jpeg\" alt=\"controllo dei pin GPIO\" width=\"525\" height=\"394\"\/><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Do not turn on the Raspberry yet, first you will need to get an image of the operating system to install &#8230;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Operating_system_configuration\"><\/span><strong><strong>Operating system configuration<\/strong><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Install the Raspbian operating system (usually already present on the MicroSD) which, however, can also be <a href=\"https:\/\/www.raspberrypi.org\/downloads\/\">downloaded directly from the official Raspberry Pi website<\/a>.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">I found a useful free tool called <a href=\"https:\/\/etcher.io\/\">Etcher<\/a> available on the Resin.io website to transfer the operating system image directly to the micro SD card, without worrying about having to format it first or perform other preliminary operations.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">This operation is also very simple to carry out, in any case, watch this video to carry out the operation in total safety.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"How To Install Raspbian On The Raspberry Pi 4 Model B\" width=\"800\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/M26GYJzblEY?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Once the operating system is installed, make sure you can log in and have a working wired or wifi internet connection set up.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now you can continue to the next step and start turning the LEDs of our traffic light on and off\u2026!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Dependency_installation\"><\/span><strong><strong>Dependency installation<\/strong><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Since Bash comes with the operating system, the only thing left to install is git, which will allow you to download the script ready to be executed by the Raspberry from the internet, then type the command lines directly from the terminal, which will allow you to install git and download the sample code from the internet ready to put our semaphore into action:<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><span style=\"color:#ff6900\" class=\"tadv-color\"><strong>$<\/strong> sudo apt-get install git<br><strong>$<\/strong> git &#8211;versiongit <\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Download_the_sample_code\"><\/span><strong><strong>Download the sample code<\/strong><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Click on this <a href=\"https:\/\/miro.medium.com\/max\/640\/1*4jWVtzo-Pgr_TOGYnuhu-g.gif\">link<\/a> and then on the green &#8220;Code&#8221; button and again on Zip download. Or type the following command directly from the terminal:<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><strong>$<\/strong> git clone <a href=\"https:\/\/github.com\/simonprickett\/bash-traffic-lights-pi.git\" target=\"_blank\" rel=\"noreferrer noopener sponsored nofollow\">https:\/\/github.com\/simonprickett\/bash-traffic-lights-pi.git<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Unzip the zip file and inside you will find the <strong>&#8220;bash-traffic-lights-pi-master&#8221;<\/strong> folder with some files inside it including the &#8220;trafficlights.sh&#8221; file.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">At this point, drag the <strong>&#8220;bash-traffic-lights-pi-master&#8221;<\/strong> folder to the desktop, and keep it pending for a few minutes, we will need it later.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The<strong> \u201ctrafficlights.sh\u201d<\/strong> file contains all the commands in bash to be able to configure the GPIO lines and activate the led traffic light.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Access_to_GPIO_pins_from_Bash_scripts\"><\/span><strong>Access to GPIO pins from Bash scripts<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Without adding additional dependencies, Bash scripts can access and control the Raspberry&#8217;s GPIO pins using sysfs. The process of configuring these pins is limited to the simple management of a set of filesystem paths that can be manipulated to configure each single pin of the GPIO as input or output and to set and \/ or read their values. On Raspbian, these paths look like this:<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><em><span style=\"color:#ff6900\" class=\"tadv-color\">\/sys\/class\/gpio\/gpio&lt;pin_number&gt;<\/span><\/em><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">and each has a \/direction (direction for example, in and out) and a \/value (value), for example for GPIO 11:<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><em><span style=\"color:#ff6900\" class=\"tadv-color\">\/sys\/class\/gpio\/gpio11\/direction<br>\/sys\/class\/gpio\/gpio11\/value<\/span><\/em><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">As we will see later in this article, the direction and the value can be set by passing appropriate parameters to these &#8220;paths&#8221; as the root user on the Raspberry.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The pin numbering scheme used by sysfs is the one provided by Broadcom (BCM), so the pin numbers you need to use will correspond to those shown in the figure:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/700\/1*hpWauYmkDz2ha955KmHWMw.png\" alt=\"controllo dei pin GPIO\" width=\"700\" height=\"217\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Running_the_script\"><\/span><strong>Running the script<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Starting the script is simple, first of all from the decompression, carried out previously, of the zip file from the GitHub repository we obtained a folder located on the desktop, remember?<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Now type the following commands to be able to run the script:<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><span style=\"color:#ff6900\" class=\"tadv-color\"><strong>$<\/strong> cd bash-traffic-lights-pi<br><strong>$<\/strong> sudo .\/trafficlights.sh<\/span><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">To stop the demo, press Ctrl-C at any time.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Note the use of sudo when starting the script. This allows it to function as a root user with access to write the file paths needed to control GPIO pins using sysfs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_does_it_work\"><\/span><strong>How does it work<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Taking a look at the code contained in the trafficlights.sh script, we can see that:<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Lines 1 to 13 set some variables in order to associate more meaningful names to these variables which will be subsequently recalled in the script.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The red LED is on GPIO pin 9, the yellow one on pin 10 and the green one on pin 11. We have also abstracted the base path <em><strong>\/sys\/class\/gpio<\/strong><\/em> as we will use it very often and therefore to avoid repetition we will use the associated variable for convenience .<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">ON and OFF are used as they are more significant than the actual Boolean values 1 and 0 that will be used by the script.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Export_of_pins\"><\/span><strong><strong>Export of pins<\/strong><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">In order to use a GPIO pin via sysfs, we must first &#8220;export&#8221;, through the export command, the paths relative to the various pins to make the subsequent commands for managing the GPIO lines available.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The exportPin function on lines 16\u201321 does just that. For example, to export pin 9 will use the following command:<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><span style=\"color:#ff6900\" class=\"tadv-color\"><em>echo &#8220;9&#8221;&gt; \/sys\/class\/gpio\/export<\/em><\/span><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">This creates an appropriate \/ sys \/ class \/ gpio path structure for pin 9 but an error will be raised if those paths already exist. To work around this, the exportPin function first checks and will export a pin, only if the path doesn&#8217;t already exist.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Setting_the_direction_of_the_GPIO_pins\"><\/span><strong><strong>Setting the direction of the GPIO pins<\/strong><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The pins can be used, respectively, for the input or output of a signal. In this case we have to use them as outputs to control each of the three LEDs on the traffic light.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The setOutput function (lines 24\u201327) does this, via the &#8220;out&#8221; parameter sent to the &#8220;direction&#8221; folder for the respective pin. Example to set GPIO pin 9 as output, you do it by running the following command:<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><em><span style=\"color:#ff6900\" class=\"tadv-color\">echo &#8220;out&#8221;&gt; \/sys\/class\/gpio\/gpio9\/direction<\/span><\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Lights_on_and_off\"><\/span><strong><strong>Lights on and off<\/strong><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The setLightState function on lines 30\u201333 manages the switching on and off of each LED by setting its respective GPIO pin to high (1 &#8211; on) or low (0 &#8211; off).<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">And it does so by writing the value 1 or 0 to the &#8220;value&#8221; path for the desired pin. Example for pin 9 of the GPIO the following command sets this pin to logic 1, then to 3.3 volts, and then the relative connected led will light up:<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\"><em><span style=\"color:#ff6900\" class=\"tadv-color\">echo &#8220;1&#8221;&gt; \/sys\/class\/gpio\/gpio9\/value<\/span><\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Deactivation_of_everything_on_exit\"><\/span><strong><strong>Deactivation of everything on exit<\/strong><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The code will run in an infinite loop that ends when you press Ctrl-C and the SIGINT signal is sent to the script that will block its execution.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">To turn off all three LEDs when this signal is sent, we need to intercept and manage the SIGINT signal. This is achieved with the code on lines 44-50 defining a shutdown function and registering it as a handler for the SIGINT signal.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">shutdown calls another utility function which in turn calls setLightState which turns off the three leds. It then uses exit to cleanly abort the script, thus returning control to the Linux shell.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_main_loop\"><\/span><strong><strong>The main loop<\/strong><\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The script entry point begins at line 52 and uses the functions defined above to export each of the three required pins and set them as output. Then it calls the utility function allLightsOff which guarantees that all three LEDs of the traffic light are off in order to be in the required state to then start the loop.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Lines 66 through 89 go through an infinite loop in which we use setLightState to turn the individual traffic light LEDs on and off in order.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The sleep command allows the code to maintain the status of the LED concerned for a few seconds before moving on to the next one.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Raspberry Pi GPIO Tutorial: The Basics Explained\" width=\"800\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/6PuK9fh3aL8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<a href=\"https:\/\/www.phpcodewizard.it\" alt=\"php code generator\"><\/a>\n","protected":false},"excerpt":{"rendered":"<p>Use a Bash script to operate LEDs using the Raspberry GPIO pin control.<\/p>\n","protected":false},"author":1,"featured_media":3399,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[268,1059],"tags":[5090,5172,3799,3721,3044,2839,3688,2843],"class_list":["post-3397","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles-en","category-development","tag-ai-en","tag-git-en","tag-internet-en","tag-root-en","tag-system-en","tag-to-en","tag-tool-en","tag-video-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Controlling Raspberry Pi GPIO Pins from Script<\/title>\n<meta name=\"description\" content=\"We will learn, in this guide, to use a Bash script to operate LEDs using the Raspberry GPIO pin control.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Controlling Raspberry Pi GPIO Pins from Script\" \/>\n<meta property=\"og:description\" content=\"We will learn, in this guide, to use a Bash script to operate LEDs using the #Raspberry GPIO pin control.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/\" \/>\n<meta property=\"og:site_name\" content=\"Antonio Lamorgese\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-08T17:00:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-04T10:43:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2020\/10\/Controlling-Raspberry-Pi-GPIO-Pins-from-Script.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"450\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Antonio Lamorgese\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Controlling Raspberry Pi GPIO Pins from Script\" \/>\n<meta name=\"twitter:description\" content=\"We will learn, in this guide, to use a Bash script to operate LEDs using the #Raspberry GPIO pin control.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2020\/10\/Controlling-Raspberry-Pi-GPIO-Pins-from-Script.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@AntonioLamorge3\" \/>\n<meta name=\"twitter:site\" content=\"@AntonioLamorge3\" \/>\n<meta name=\"twitter:label1\" content=\"Scritto da\" \/>\n\t<meta name=\"twitter:data1\" content=\"Antonio Lamorgese\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tempo di lettura stimato\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/controlling-raspberry-pi-gpio-pins-from-script\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/controlling-raspberry-pi-gpio-pins-from-script\\\/\"},\"author\":{\"name\":\"Antonio Lamorgese\",\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/#\\\/schema\\\/person\\\/264cf3af38edc93a3362a4c47ec5b2f0\"},\"headline\":\"Controlling Raspberry Pi GPIO Pins from Script\",\"datePublished\":\"2020-10-08T17:00:07+00:00\",\"dateModified\":\"2022-12-04T10:43:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/controlling-raspberry-pi-gpio-pins-from-script\\\/\"},\"wordCount\":1506,\"publisher\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/#\\\/schema\\\/person\\\/264cf3af38edc93a3362a4c47ec5b2f0\"},\"image\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/controlling-raspberry-pi-gpio-pins-from-script\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/Controlling-Raspberry-Pi-GPIO-Pins-from-Script.jpg\",\"keywords\":[\"AI\",\"git\",\"internet\",\"root\",\"system\",\"to\",\"tool\",\"video\"],\"articleSection\":[\"Blog Articles\",\"Development\"],\"inLanguage\":\"it-IT\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/controlling-raspberry-pi-gpio-pins-from-script\\\/\",\"url\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/controlling-raspberry-pi-gpio-pins-from-script\\\/\",\"name\":\"Controlling Raspberry Pi GPIO Pins from Script\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/controlling-raspberry-pi-gpio-pins-from-script\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/controlling-raspberry-pi-gpio-pins-from-script\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/Controlling-Raspberry-Pi-GPIO-Pins-from-Script.jpg\",\"datePublished\":\"2020-10-08T17:00:07+00:00\",\"dateModified\":\"2022-12-04T10:43:17+00:00\",\"description\":\"We will learn, in this guide, to use a Bash script to operate LEDs using the Raspberry GPIO pin control.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/controlling-raspberry-pi-gpio-pins-from-script\\\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/controlling-raspberry-pi-gpio-pins-from-script\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/controlling-raspberry-pi-gpio-pins-from-script\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/Controlling-Raspberry-Pi-GPIO-Pins-from-Script.jpg\",\"contentUrl\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/Controlling-Raspberry-Pi-GPIO-Pins-from-Script.jpg\",\"width\":800,\"height\":450,\"caption\":\"controlling Raspberry GPIO\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/controlling-raspberry-pi-gpio-pins-from-script\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Development\",\"item\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/en\\\/category\\\/development\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Controlling Raspberry Pi GPIO Pins from Script\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/#website\",\"url\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/\",\"name\":\"Antonio Lamorgese\",\"description\":\"Il web e i suoi strumenti operativi\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/#\\\/schema\\\/person\\\/264cf3af38edc93a3362a4c47ec5b2f0\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"it-IT\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/#\\\/schema\\\/person\\\/264cf3af38edc93a3362a4c47ec5b2f0\",\"name\":\"Antonio Lamorgese\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/ChiSono.png\",\"url\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/ChiSono.png\",\"contentUrl\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/ChiSono.png\",\"width\":120,\"height\":130,\"caption\":\"Antonio Lamorgese\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/wp-content\\\/uploads\\\/2019\\\/06\\\/ChiSono.png\"},\"description\":\"Amministratore di rete e sviluppatore. Dopo anni di esperienza nel settore, ho ideato un sistema di gestione dati MYSQL in PHP senza scrivere una sola riga di codice.&nbsp;Scopri di pi\u00f9....\",\"sameAs\":[\"https:\\\/\\\/www.Phpcodewizard.it\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/antonio-lamorgese-660735190\\\/\",\"https:\\\/\\\/pinterest.it\\\/antoniolamorgese9711\\\/\",\"https:\\\/\\\/x.com\\\/AntonioLamorge3\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/antoniolamorgese\",\"https:\\\/\\\/tumblr.com\\\/blog\\\/phpcodewizard\"],\"url\":\"https:\\\/\\\/www.phpcodewizard.it\\\/antoniolamorgese\\\/author\\\/antonio-lamorgese\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Controlling Raspberry Pi GPIO Pins from Script","description":"We will learn, in this guide, to use a Bash script to operate LEDs using the Raspberry GPIO pin control.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/","og_locale":"it_IT","og_type":"article","og_title":"Controlling Raspberry Pi GPIO Pins from Script","og_description":"We will learn, in this guide, to use a Bash script to operate LEDs using the #Raspberry GPIO pin control.","og_url":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/","og_site_name":"Antonio Lamorgese","article_published_time":"2020-10-08T17:00:07+00:00","article_modified_time":"2022-12-04T10:43:17+00:00","og_image":[{"width":800,"height":450,"url":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2020\/10\/Controlling-Raspberry-Pi-GPIO-Pins-from-Script.jpg","type":"image\/jpeg"}],"author":"Antonio Lamorgese","twitter_card":"summary_large_image","twitter_title":"Controlling Raspberry Pi GPIO Pins from Script","twitter_description":"We will learn, in this guide, to use a Bash script to operate LEDs using the #Raspberry GPIO pin control.","twitter_image":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2020\/10\/Controlling-Raspberry-Pi-GPIO-Pins-from-Script.jpg","twitter_creator":"@AntonioLamorge3","twitter_site":"@AntonioLamorge3","twitter_misc":{"Scritto da":"Antonio Lamorgese","Tempo di lettura stimato":"9 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#article","isPartOf":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/"},"author":{"name":"Antonio Lamorgese","@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/#\/schema\/person\/264cf3af38edc93a3362a4c47ec5b2f0"},"headline":"Controlling Raspberry Pi GPIO Pins from Script","datePublished":"2020-10-08T17:00:07+00:00","dateModified":"2022-12-04T10:43:17+00:00","mainEntityOfPage":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/"},"wordCount":1506,"publisher":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/#\/schema\/person\/264cf3af38edc93a3362a4c47ec5b2f0"},"image":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#primaryimage"},"thumbnailUrl":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2020\/10\/Controlling-Raspberry-Pi-GPIO-Pins-from-Script.jpg","keywords":["AI","git","internet","root","system","to","tool","video"],"articleSection":["Blog Articles","Development"],"inLanguage":"it-IT"},{"@type":"WebPage","@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/","url":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/","name":"Controlling Raspberry Pi GPIO Pins from Script","isPartOf":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#primaryimage"},"image":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#primaryimage"},"thumbnailUrl":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2020\/10\/Controlling-Raspberry-Pi-GPIO-Pins-from-Script.jpg","datePublished":"2020-10-08T17:00:07+00:00","dateModified":"2022-12-04T10:43:17+00:00","description":"We will learn, in this guide, to use a Bash script to operate LEDs using the Raspberry GPIO pin control.","breadcrumb":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/"]}]},{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#primaryimage","url":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2020\/10\/Controlling-Raspberry-Pi-GPIO-Pins-from-Script.jpg","contentUrl":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2020\/10\/Controlling-Raspberry-Pi-GPIO-Pins-from-Script.jpg","width":800,"height":450,"caption":"controlling Raspberry GPIO"},{"@type":"BreadcrumbList","@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/controlling-raspberry-pi-gpio-pins-from-script\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/"},{"@type":"ListItem","position":2,"name":"Development","item":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/en\/category\/development\/"},{"@type":"ListItem","position":3,"name":"Controlling Raspberry Pi GPIO Pins from Script"}]},{"@type":"WebSite","@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/#website","url":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/","name":"Antonio Lamorgese","description":"Il web e i suoi strumenti operativi","publisher":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/#\/schema\/person\/264cf3af38edc93a3362a4c47ec5b2f0"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"it-IT"},{"@type":["Person","Organization"],"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/#\/schema\/person\/264cf3af38edc93a3362a4c47ec5b2f0","name":"Antonio Lamorgese","image":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2019\/06\/ChiSono.png","url":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2019\/06\/ChiSono.png","contentUrl":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2019\/06\/ChiSono.png","width":120,"height":130,"caption":"Antonio Lamorgese"},"logo":{"@id":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-content\/uploads\/2019\/06\/ChiSono.png"},"description":"Amministratore di rete e sviluppatore. Dopo anni di esperienza nel settore, ho ideato un sistema di gestione dati MYSQL in PHP senza scrivere una sola riga di codice.&nbsp;Scopri di pi\u00f9....","sameAs":["https:\/\/www.Phpcodewizard.it\/","https:\/\/www.linkedin.com\/in\/antonio-lamorgese-660735190\/","https:\/\/pinterest.it\/antoniolamorgese9711\/","https:\/\/x.com\/AntonioLamorge3","https:\/\/www.youtube.com\/user\/antoniolamorgese","https:\/\/tumblr.com\/blog\/phpcodewizard"],"url":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/author\/antonio-lamorgese\/"}]}},"permalink_manager":null,"_links":{"self":[{"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/posts\/3397","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/comments?post=3397"}],"version-history":[{"count":0,"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/posts\/3397\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/media\/3399"}],"wp:attachment":[{"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/media?parent=3397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/categories?post=3397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpcodewizard.it\/antoniolamorgese\/wp-json\/wp\/v2\/tags?post=3397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}