{"id":76,"date":"2017-07-17T18:59:07","date_gmt":"2017-07-17T17:59:07","guid":{"rendered":"http:\/\/192.168.1.18\/?page_id=76"},"modified":"2021-05-26T14:57:27","modified_gmt":"2021-05-26T13:57:27","slug":"controlling-led-raspberry-pi","status":"publish","type":"page","link":"http:\/\/www.bulis.co.uk\/?page_id=76","title":{"rendered":"Raspberry Pi: Connecting an LED"},"content":{"rendered":"<p>Light-Emitting Diodes are semi-conductors which glow when a voltage is applied. LED\u2019s come in many different colours, shapes and sizes:<\/p>\n<div id=\"attachment_77\" style=\"width: 641px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-77\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-77\" src=\"http:\/\/www.bulis.co.uk\/wp-content\/uploads\/2017\/07\/image1.jpeg\" alt=\"Various LED's\" width=\"631\" height=\"222\" \/><p id=\"caption-attachment-77\" class=\"wp-caption-text\">Collection of various LED&#8217;s<\/p><\/div>\n<p>The LED requires a resistor to be wired in-line to reduce the voltage otherwise the LED will be bright but won\u2019t last as long. I have decided to use a resistor with a value of 220 ohms. This is to be wired to one of the GPIO pins; in this example I have chosen to use pin number 12 (please see <a href=\"http:\/\/www.bulis.co.uk\/?page_id=76\">Connecting Hardware <\/a>):<\/p>\n<div id=\"attachment_78\" style=\"width: 473px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-78\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-78\" src=\"http:\/\/www.bulis.co.uk\/wp-content\/uploads\/2017\/07\/image2.png\" alt=\"RPi Zero LED wiring diagram\" width=\"463\" height=\"434\" \/><p id=\"caption-attachment-78\" class=\"wp-caption-text\">Raspberry Pi LED wiring diagram<\/p><\/div>\n<div>\n<p>To test the LED and wiring open a terminal window and type the following to start the Python interpreter.<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nsudo python\r\n<\/pre>\n<p>Next type:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport RPi.GPIO as GPIO\r\nLED_PIN = 12\r\nGPIO.setmode(GPIO.BOARD)\r\nGPIO.setup(LED_PIN, GPIO.OUT)\r\nGPIO.setwarnings(False)\r\nGPIO.output(LED_PIN, GPIO.HIGH)\r\n<\/pre>\n<p>The LED should now be lit. To turn the LED off again type:<\/p>\n<\/div>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nGPIO.output(LED_PIN, GPIO.LOW)\r\n<\/pre>\n<div id=\"attachment_79\" style=\"width: 370px\" class=\"wp-caption alignright\"><img aria-describedby=\"caption-attachment-79\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-79\" src=\"http:\/\/www.bulis.co.uk\/wp-content\/uploads\/2017\/07\/image3.png\" alt=\"Morse Code\" width=\"360\" height=\"331\" \/><p id=\"caption-attachment-79\" class=\"wp-caption-text\"><strong>Morse Code<\/strong><\/p><\/div>\n<h2><strong>Using the LED to display Morse Code<\/strong><\/h2>\n<p>Now that we have a working LED let\u2019s try something a little more interesting. Let\u2019s try using this LED to flash on and off using Morse code.<\/p>\n<p>Morse code uses a series of dots and dashes to represent letters and numbers. Letters that are used more frequently have a fewer number of dots or dashes; therefore the letter <strong>\u201cE\u201d<\/strong> has one dot and the letter <strong>\u201cT\u201d<\/strong> has one dash. Whereas letters like <strong>\u201cQ\u201d <\/strong>and<strong> \u201cZ\u201d<\/strong> have four dots or dashes.<\/p>\n<p>The timing of Morse code is based on the length of a unit. A dot is one unit and a dash is three units. The space between parts of the same letter is one unit, the space between letters is three units and the space between words is seven units. In the following example the word PARIS would contain a total of fifty units:<\/p>\n<div id=\"attachment_80\" style=\"width: 610px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-80\" decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-80\" src=\"http:\/\/www.bulis.co.uk\/wp-content\/uploads\/2017\/07\/image4.png\" alt=\"Morse code timing\" width=\"600\" height=\"100\" \/><p id=\"caption-attachment-80\" class=\"wp-caption-text\">Morse code timing<\/p><\/div>\n<p>To write a program to implement Morse code we need to import the Python GPIO library, the time library and define the code for each letter. We also want the user to be prompted to type in a message to be converted. Copy the following and save as led_morse_code.py:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n#!\/usr\/bin\/env python\r\n\r\n# Encode message to Morse code and\r\n# flash the red led. \r\n\r\nimport RPi.GPIO as GPIO\r\nimport time\r\n\r\nTURN_ON = 1\r\nTURN_OFF = 0\r\nDOT_LENGTH = 0.2\r\n\r\nCODE = {' ': ' ',\r\n        &quot;'&quot;: '.----.',\r\n        '(': '-.--.-',\r\n        ')': '-.--.-',\r\n        ',': '--..--',\r\n        '-': '-....-',\r\n        '.': '.-.-.-',\r\n        '\/': '-..-.',\r\n        '0': '-----',\r\n        '1': '.----',\r\n        '2': '..---',\r\n        '3': '...--',\r\n        '4': '....-',\r\n        '5': '.....',\r\n        '6': '-....',\r\n        '7': '--...',\r\n        '8': '---..',\r\n        '9': '----.',\r\n        ':': '---...',\r\n        ';': '-.-.-.',\r\n        '?': '..--..',\r\n        'A': '.-',\r\n        'B': '-...',\r\n        'C': '-.-.',\r\n        'D': '-..',\r\n        'E': '.',\r\n        'F': '..-.',\r\n        'G': '--.',\r\n        'H': '....',\r\n        'I': '..',\r\n        'J': '.---',\r\n        'K': '-.-',\r\n        'L': '.-..',\r\n        'M': '--',\r\n        'N': '-.',\r\n        'O': '---',\r\n        'P': '.--.',\r\n        'Q': '--.-',\r\n        'R': '.-.',\r\n        'S': '...',\r\n        'T': '-',\r\n        'U': '..-',\r\n        'V': '...-',\r\n        'W': '.--',\r\n        'X': '-..-',\r\n        'Y': '-.--',\r\n        'Z': '--..',\r\n        '_': '..--.-'}\r\n\r\n\r\nclass MorseCode():\r\n\r\n    def __init__(self, led_pin, speaker_pin=None):\r\n        self.LED_PIN = led_pin\r\n        self.SPEAKER_PIN = speaker_pin\r\n        GPIO.setmode(GPIO.BOARD)\r\n        GPIO.setwarnings(False)\r\n        # Setup all the pins\r\n        GPIO.setup(self.LED_PIN, GPIO.OUT)\r\n        if speaker_pin is not None:\r\n            GPIO.setup(self.SPEAKER_PIN, GPIO.OUT)\r\n\r\n    def _dot(self):\r\n        GPIO.output(self.LED_PIN, TURN_ON)\r\n        GPIO.output(self.SPEAKER_PIN, TURN_ON)\r\n        time.sleep(DOT_LENGTH)\r\n        GPIO.output(self.LED_PIN, TURN_OFF)\r\n        GPIO.output(self.SPEAKER_PIN, TURN_OFF)\r\n        time.sleep(DOT_LENGTH)\r\n\r\n    def _dash(self):\r\n        GPIO.output(self.LED_PIN, TURN_ON)\r\n        if self.SPEAKER_PIN is not None:\r\n            GPIO.output(self.SPEAKER_PIN, TURN_ON)\r\n        time.sleep(DOT_LENGTH * 3)\r\n        GPIO.output(self.LED_PIN, TURN_OFF)\r\n        if self.SPEAKER_PIN is not None:\r\n            GPIO.output(self.SPEAKER_PIN, TURN_OFF)\r\n        time.sleep(DOT_LENGTH)\r\n\r\n    def message(self, msg_txt):\r\n        for letter in msg_txt:\r\n            for symbol in CODE&#x5B;letter.upper()]:\r\n                if symbol == '-':\r\n                    self._dash()\r\n                elif symbol == '.':\r\n                    self._dot()\r\n                else:\r\n                    time.sleep(DOT_LENGTH * 7)\r\n\r\n# Check if running stand-alone or imported\r\nif __name__ == '__main__':\r\n    LED_PIN = 12\r\n    SPKR_PIN = 22\r\n    mc = MorseCode(LED_PIN, SPKR_PIN)\r\n    try:\r\n        while True:\r\n            input = raw_input('What message would you like to send? ')\r\n            if input:\r\n                mc.message(input)\r\n            else:\r\n                print '\\nQuit'\r\n                quit()\r\n    except KeyboardInterrupt:\r\n        print 'Quit'\r\n\r\n    # Tidy up and remaining connections.\r\n    GPIO.cleanup()<\/pre>\n<p>When you start the program you will be greeted with \u201cWhat would you like to send?\u201d. Type in the message you want converting to Morse code and press the enter key. You should now see your message converted to Morse code as a series of flashes that represent dots and dashes.<\/p>\n<h2><strong>Using a Tri-Colour LED<\/strong><\/h2>\n<p>There is another type of LED that combines the red, green and blue LED\u2019s into one. These tri-coloured LED\u2019s can be used to not only change the colour from red, green and blue but can mix these colours to create a wide range of colours, in the same way a pixel on your TV screen does.<\/p>\n<p>The red led isn\u2019t as efficient as the green and the blue led\u2019s so to reduce the brightness of the green and blue led\u2019s we have connected a 220 ohm resistor and a 100 ohm resistor.<\/p>\n<p>When all three led\u2019s are lit at the same time the colour produced is closer to white. Tri-coloured LED\u2019s have four legs from left to right these are red, ground, green and blue (the longest leg represents ground). These are to be wired to three of the GPIO pins; in this example I have chosen to use pin numbers 12 (red), 16 (green) and 18 (blue):<\/p>\n<div id=\"attachment_81\" style=\"width: 471px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-81\" decoding=\"async\" loading=\"lazy\" class=\" wp-image-81\" src=\"http:\/\/www.bulis.co.uk\/wp-content\/uploads\/2017\/07\/image5.png\" alt=\"RPi Zero RGB LED wiring diagram\" width=\"461\" height=\"511\" \/><p id=\"caption-attachment-81\" class=\"wp-caption-text\">Raspberry Pi RGB LED wiring diagram<\/p><\/div>\n<h2>Seven Basic Colours<\/h2>\n<p>The following script can change the colour of the LED to one of seven different colours by combining the output of red, green and blue LED&#8217;s:<\/p>\n<p>led_rgb.py<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n#!\/usr\/bin\/env python\r\n \r\n# Written By: Phantom Raspberry Blower\r\n# Date: 27-05-2016\r\n# Operate an RGB LED. Supply the pin numbers for\r\n# red, green &amp; blue leds and choose from seven\r\n# colours: red, green, blue, yellow, pink, sky and white\r\n \r\nimport time\r\nimport RPi.GPIO as GPIO\r\n \r\n \r\nclass LedRgb():\r\n \r\n    def __init__(self, red_pin, green_pin, blue_pin):\r\n        # Define gpio as BOARD numbering (not BCM naming)\r\n        GPIO.setmode(GPIO.BOARD)\r\n        # Disable warnings caused when you set an LED high that is already high\r\n        GPIO.setwarnings(False)\r\n        # Define the pin numbers for red, green and blue led's\r\n        self.led_pins = (red_pin, green_pin, blue_pin)\r\n        # Setup all the pins as outputs\r\n        for col in self.led_pins:\r\n            GPIO.setup(col, GPIO.OUT)\r\n \r\n    def _reset(self):\r\n        # Turn all LED's off\r\n        for col in self.led_pins:\r\n            GPIO.output(col, GPIO.LOW)\r\n \r\n    def _colour(self, R, G, B):\r\n        # Turn off all colours\r\n        self._reset()\r\n        self.current_rgb = (R, G, B)\r\n        # Turn on selected colours\r\n        if R == 1:\r\n            GPIO.output(self.led_pins&#x5B;0], GPIO.HIGH)\r\n        if G == 1:\r\n            GPIO.output(self.led_pins&#x5B;1], GPIO.HIGH)\r\n        if B == 1:\r\n            GPIO.output(self.led_pins&#x5B;2], GPIO.HIGH)\r\n \r\n    def off(self):\r\n        self._reset()\r\n \r\n    def on(self):\r\n        self._colour(self.current_rgb&#x5B;0],\r\n                     self.current_rgb&#x5B;1],\r\n                     self.current_rgb&#x5B;2])\r\n \r\n    def red(self):\r\n        self._colour(1, 0, 0)\r\n \r\n    def green(self):\r\n        self._colour(0, 1, 0)\r\n \r\n    def blue(self):\r\n        self._colour(0, 0, 1)\r\n \r\n    def yellow(self):\r\n        self._colour(1, 1, 0)\r\n \r\n    def pink(self):\r\n        self._colour(1, 0, 1)\r\n \r\n    def sky(self):\r\n        self._colour(0, 1, 1)\r\n \r\n    def white(self):\r\n        self._colour(1, 1, 1)\r\n \r\n    def flash_led(self, count):\r\n        # Set maximum number of flashes to seven\r\n        if count &gt; 7:\r\n            count = 7\r\n            # Flash led for each item in count\r\n            while count &gt; 0:\r\n                self.off()\r\n                time.sleep(0.2)\r\n                self.on()\r\n                time.sleep(0.2)\r\n                count -= 1\r\n \r\n    def close(self):\r\n        self._reset()\r\n        GPIO.cleanup()\r\n \r\n# Check if running stand-alone or imported\r\nif __name__ == '__main__':\r\n    import led_rgb\r\n    LED_RED_PIN = 12\r\n    LED_GREEN_PIN = 16\r\n    LED_BLUE_PIN = 18\r\n    try:\r\n        led = LedRgb(LED_RED_PIN, LED_GREEN_PIN, LED_BLUE_PIN)\r\n        options = {'red': led.red,\r\n                   'green': led.green,\r\n                   'blue': led.blue,\r\n                   'yellow': led.yellow,\r\n                   'pink': led.pink,\r\n                   'sky': led.sky,\r\n                   'white': led.white,\r\n                   'off': led.off}\r\n        while True:\r\n            # Prompt user for colour selection\r\n            response = raw_input('Enter a colour (red, green, blue, yellow, '\r\n                                 'pink, sky, white or off): ')\r\n            if response in &#x5B;'exit', 'quit']:\r\n                led.close()\r\n                quit()\r\n            try:\r\n                options&#x5B;response]()\r\n            except:\r\n                pass\r\n    except KeyboardInterrupt:\r\n        print &quot;\\nQuit&quot;\r\n \r\n    # Tidy up remaining connections.\r\n    GPIO.cleanup()\r\n<\/pre>\n<h2>All the Colours Inbetween<\/h2>\n<p>To get far more than the basic seven colours using PWM (pulse width modulation). By pulsing we can vary the amount of red, green and blue emitted. For example if we want to have more red we can pulse the green and blue whilst leaving the red switched on continuously.\u00a0 The following script will keep changing the colour of the LED to demonstrate:<\/p>\n<p>led_pulse.py<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n#!\/usr\/bin\/python3\r\n# Controlling an RGB LED with built in PWM.\r\n\r\nfrom time import sleep\r\nimport RPi.GPIO as GPIO\r\nimport math\r\n\r\n\r\nclass LedPulse():\r\n\r\n    def __init__(self, red_led_pin, green_led_pin, blue_led_pin):\r\n        # Pin numbers to match LED legs\r\n        self.LED_RED_PIN = red_led_pin  # Red LED\r\n        self.LED_GREEN_PIN = green_led_pin  # Green LED\r\n        self.LED_BLUE_PIN = blue_led_pin  # Blue LED\r\n\r\n        # Use GPIO Board numbering system\r\n        GPIO.setmode(GPIO.BOARD)\r\n\r\n        # Setup all the pins\r\n        GPIO.setup(self.LED_RED_PIN, GPIO.OUT)\r\n        GPIO.setup(self.LED_GREEN_PIN, GPIO.OUT)\r\n        GPIO.setup(self.LED_BLUE_PIN, GPIO.OUT)\r\n\r\n        # Set PWM Frequency\r\n        self.Freq = 100  # 100 Hz\r\n\r\n        # Setup all the colours\r\n        self.RED_LED = GPIO.PWM(self.LED_RED_PIN, self.Freq)  # Pin, frequency\r\n        self.RED_LED.start(0)  # Initial duty cycle of 0, so off\r\n        self.GREEN_LED = GPIO.PWM(self.LED_GREEN_PIN, self.Freq)\r\n        self.GREEN_LED.start(0)\r\n        self.BLUE_LED = GPIO.PWM(self.LED_BLUE_PIN, self.Freq)\r\n        self.BLUE_LED.start(0)\r\n\r\n    def colour(self, R, G, B, on_time):\r\n        # Colour brightness range is 0-100\r\n        self.RED_LED.ChangeDutyCycle(R)\r\n        self.GREEN_LED.ChangeDutyCycle(G)\r\n        self.BLUE_LED.ChangeDutyCycle(B)\r\n        sleep(on_time)\r\n\r\n        # Turn everything off\r\n        self.RED_LED.ChangeDutyCycle(0)\r\n        self.GREEN_LED.ChangeDutyCycle(0)\r\n        self.BLUE_LED.ChangeDutyCycle(0)\r\n\r\n    def PosSinWave(self, amplitude, angle, frequency):\r\n        # Angle in degrees creates a positive sin wave\r\n        # between 0 and amplitude * 2\r\n        return amplitude + (amplitude *\r\n                            math.sin(math.radians(angle) * frequency))\r\n\r\n    def __del__(self):\r\n        # Stop all the PWN objects\r\n        self.RED_LED.stop()\r\n        self.GREEN_LED.stop()\r\n        self.BLUE_LED.stop()\r\n        # Tidyup remaining connections\r\n        GPIO.cleanup()\r\n\r\n# Check if running stand-alone or imported\r\nif __name__ == '__main__':\r\n    import led_pulse\r\n    LED_RED_PIN = 12\r\n    LED_GREEN_PIN = 16\r\n    LED_BLUE_PIN = 18\r\n    lp = LedPulse(LED_RED_PIN, LED_GREEN_PIN, LED_BLUE_PIN)\r\n    try:\r\n        while True:\r\n            for i in range(0, 720, 5):\r\n                lp.colour(lp.PosSinWave(50, i, 0.5),\r\n                          lp.PosSinWave(50, i, 1),\r\n                          lp.PosSinWave(50, i, 2),\r\n                          0.1)\r\n    except KeyboardInterrupt:\r\n        print '\\nQuit'\r\n\r\n<\/pre>\n<p>There are a number of useful things we can do with tri-colour LED\u2019s for example:<\/p>\n<ul>\n<li>Temperature Sensor<\/li>\n<li>Represent Day of the Week or Time of the Day<\/li>\n<li>Email, Facebook and Twitter Notifications<\/li>\n<li>Motion Detection<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Light-Emitting Diodes are semi-conductors which glow when a voltage is applied. LED\u2019s come in many different colours, shapes and sizes: The LED requires a resistor to be wired in-line to reduce the voltage otherwise the LED will be bright but won\u2019t last as long. I have decided to use a resistor with a value of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":166,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.12 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Raspberry Pi: Connecting an LED - Phantom Raspberry Blower<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.bulis.co.uk\/?page_id=76\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Raspberry Pi: Connecting an LED - Phantom Raspberry Blower\" \/>\n<meta property=\"og:description\" content=\"Light-Emitting Diodes are semi-conductors which glow when a voltage is applied. LED\u2019s come in many different colours, shapes and sizes: The LED requires a resistor to be wired in-line to reduce the voltage otherwise the LED will be bright but won\u2019t last as long. I have decided to use a resistor with a value of [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.bulis.co.uk\/?page_id=76\" \/>\n<meta property=\"og:site_name\" content=\"Phantom Raspberry Blower\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-26T13:57:27+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.bulis.co.uk\/wp-content\/uploads\/2017\/07\/image1.jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.bulis.co.uk\/?page_id=76\",\"url\":\"http:\/\/www.bulis.co.uk\/?page_id=76\",\"name\":\"Raspberry Pi: Connecting an LED - Phantom Raspberry Blower\",\"isPartOf\":{\"@id\":\"http:\/\/www.bulis.co.uk\/#website\"},\"datePublished\":\"2017-07-17T17:59:07+00:00\",\"dateModified\":\"2021-05-26T13:57:27+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/www.bulis.co.uk\/?page_id=76#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.bulis.co.uk\/?page_id=76\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.bulis.co.uk\/?page_id=76#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/www.bulis.co.uk\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tutorials\",\"item\":\"http:\/\/www.bulis.co.uk\/?page_id=57\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Raspberry Pi Tutorials\",\"item\":\"http:\/\/www.bulis.co.uk\/?page_id=166\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Raspberry Pi: Connecting an LED\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.bulis.co.uk\/#website\",\"url\":\"http:\/\/www.bulis.co.uk\/\",\"name\":\"Phantom Raspberry Blower\",\"description\":\"Blowing Raspberrys since 1989\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.bulis.co.uk\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Raspberry Pi: Connecting an LED - Phantom Raspberry Blower","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":"http:\/\/www.bulis.co.uk\/?page_id=76","og_locale":"en_GB","og_type":"article","og_title":"Raspberry Pi: Connecting an LED - Phantom Raspberry Blower","og_description":"Light-Emitting Diodes are semi-conductors which glow when a voltage is applied. LED\u2019s come in many different colours, shapes and sizes: The LED requires a resistor to be wired in-line to reduce the voltage otherwise the LED will be bright but won\u2019t last as long. I have decided to use a resistor with a value of [&hellip;]","og_url":"http:\/\/www.bulis.co.uk\/?page_id=76","og_site_name":"Phantom Raspberry Blower","article_modified_time":"2021-05-26T13:57:27+00:00","og_image":[{"url":"http:\/\/www.bulis.co.uk\/wp-content\/uploads\/2017\/07\/image1.jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Estimated reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/www.bulis.co.uk\/?page_id=76","url":"http:\/\/www.bulis.co.uk\/?page_id=76","name":"Raspberry Pi: Connecting an LED - Phantom Raspberry Blower","isPartOf":{"@id":"http:\/\/www.bulis.co.uk\/#website"},"datePublished":"2017-07-17T17:59:07+00:00","dateModified":"2021-05-26T13:57:27+00:00","breadcrumb":{"@id":"http:\/\/www.bulis.co.uk\/?page_id=76#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.bulis.co.uk\/?page_id=76"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.bulis.co.uk\/?page_id=76#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.bulis.co.uk\/"},{"@type":"ListItem","position":2,"name":"Tutorials","item":"http:\/\/www.bulis.co.uk\/?page_id=57"},{"@type":"ListItem","position":3,"name":"Raspberry Pi Tutorials","item":"http:\/\/www.bulis.co.uk\/?page_id=166"},{"@type":"ListItem","position":4,"name":"Raspberry Pi: Connecting an LED"}]},{"@type":"WebSite","@id":"http:\/\/www.bulis.co.uk\/#website","url":"http:\/\/www.bulis.co.uk\/","name":"Phantom Raspberry Blower","description":"Blowing Raspberrys since 1989","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.bulis.co.uk\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"}]}},"_links":{"self":[{"href":"http:\/\/www.bulis.co.uk\/index.php?rest_route=\/wp\/v2\/pages\/76"}],"collection":[{"href":"http:\/\/www.bulis.co.uk\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.bulis.co.uk\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.bulis.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.bulis.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=76"}],"version-history":[{"count":2,"href":"http:\/\/www.bulis.co.uk\/index.php?rest_route=\/wp\/v2\/pages\/76\/revisions"}],"predecessor-version":[{"id":2460,"href":"http:\/\/www.bulis.co.uk\/index.php?rest_route=\/wp\/v2\/pages\/76\/revisions\/2460"}],"up":[{"embeddable":true,"href":"http:\/\/www.bulis.co.uk\/index.php?rest_route=\/wp\/v2\/pages\/166"}],"wp:attachment":[{"href":"http:\/\/www.bulis.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}