{"product_id":"mini-gpio-xmas-tree","title":"Mini GPIO Xmas Tree","description":"\u003cp\u003eWe're stocking this super-cute mini GPIO Xmas Tree for the Raspberry Pi this year as an uber-affordable way to add a little festive fun to your projects, as we all know that December can be expensive enough as it is!\u003c\/p\u003e\n\u003cp\u003e\u003cspan\u003eThe Mini GPIO Xmas Tree for the Raspberry Pi includes 5 LEDs that can be controlled from a simple Scratch or Python program. \u003c\/span\u003eWhen programming your tree, you need to know the GPIO pin number associated with each LED (\u003cem\u003esee below\u003c\/em\u003e). Setting a GPIO to output\u003cspan\u003e \u003c\/span\u003e\u003cb\u003ehigh\u003cspan\u003e \u003c\/span\u003e\u003c\/b\u003ewill turn the LED on whilst setting it\u003cspan\u003e \u003c\/span\u003e\u003cb\u003elow\u003cspan\u003e \u003c\/span\u003e\u003c\/b\u003ewill turn it off - easy!\u003c\/p\u003e\n\u003cp\u003eThe tree should be connected to the six GPIO pins as shown here. Ensure the LEDs are facing outwards like this:\u003c\/p\u003e\n\u003cp\u003e\u003cimg src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0176\/3274\/files\/mini-gpio-xmas-tree-connection_1.jpg?v=1669894370\u0026amp;width=700\" alt=\"\"\u003e\u003c\/p\u003e\n\u003cp\u003eThe GPIO numbers for each LED are as follows:\u003c\/p\u003e\n\u003cp\u003e\u003cimg src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0176\/3274\/files\/mini-gpio-xmas-tree-pin-numbers_1.jpg?v=1669894284\u0026amp;width=700\" alt=\"\"\u003e\u003c\/p\u003e\n\u003ch2\u003eWorks with Scratch!\u003c\/h2\u003e\n\u003cp\u003e\u003cspan\u003eDo you want to use Scratch 3 to control the LEDs on your tree? If so, click the \u003c\/span\u003e\u003cb\u003eAdd an Extension\u003cspan\u003e \u003c\/span\u003e\u003c\/b\u003e\u003cspan\u003eicon, find \u003c\/span\u003e\u003cb\u003eRaspberry Pi GPIO\u003c\/b\u003e\u003cspan\u003e and click on it. You can then drag blocks to construct either of the sample programs shown below\u003c\/span\u003e\u003c\/p\u003e\n\u003ch3\u003e\u003cspan\u003eScratch Example 1\u003c\/span\u003e\u003c\/h3\u003e\n\u003cp\u003e\u003cspan\u003e\u003cimg src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0176\/3274\/files\/scratch-example-1_1.jpg?v=1669894705\u0026amp;width=700\" alt=\"\"\u003e\u003c\/span\u003e\u003c\/p\u003e\n\u003ch3\u003e\u003cspan\u003eScratch Example 2\u003c\/span\u003e\u003c\/h3\u003e\n\u003cp\u003e\u003cimg src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0176\/3274\/files\/scratch-example-2_1.jpg?v=1669894705\u0026amp;width=700\" alt=\"\"\u003e\u003c\/p\u003e\n\u003ch2\u003e\u003cspan\u003eUse with Python via Thonny\u003c\/span\u003e\u003c\/h2\u003e\n\u003cp\u003eTo control the tree using Python, open Thonny and enter this example code:\u003c\/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-py\"\u003efrom gpiozero import LEDBoard\nfrom time import sleep\n\ntree = LEDBoard(26, 13, 6, 19, 5)\n\nwhile True:\n\n# illuminate the top and bottom LEDs\ntree.value = (1, 0, 1, 0, 1)\nsleep(0.5)\n\n# illuminate the middle row of LEDs\ntree.value = (0, 1, 0, 1, 0)\nsleep(0.5)\n\u003c\/code\u003e\u003c\/pre\u003e\n\u003ch2\u003eCompatible with Other Dev Boards!\u003c\/h2\u003e\n\u003cp\u003eEach LED is wired through a 330-ohm resistor, meaning you can use this with other development boards such as the Raspberry Pi Pico by simply connecting manually with jumper wires to your board's GPIO pins and writing code to control the GPIO pins HIGH\/LOW.\u003c\/p\u003e\n\u003ch2\u003eCircuit Diagram\u003c\/h2\u003e\n\u003cp\u003eHere is the circuit diagram for the tree:\u003c\/p\u003e\n\u003cp\u003e\u003cimg src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0176\/3274\/files\/mini-gpio-xmas-tree-schematic_1.jpg?v=1669894534\u0026amp;width=700\" alt=\"\"\u003e\u003c\/p\u003e\n\u003ch2\u003ePackage Contents\u003c\/h2\u003e\n\u003cul\u003e\n\u003cli\u003e1x Mini GPIO Xmas Tree\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003e\u003cem\u003e\u003cstrong\u003eRaspberry Pi\/wires not included\u003c\/strong\u003e\u003c\/em\u003e\u003c\/p\u003e","brand":"PocketMoneyTronics","offers":[{"title":"Default Title","offer_id":50613711536293,"sku":"fzw1791441462229","price":3.93,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0763\/7650\/6533\/files\/mini-gpio-xmas-tree_1.jpg?v=1791441468","url":"https:\/\/boldstepfashion.shop\/products\/mini-gpio-xmas-tree","provider":"My Store","version":"1.0","type":"link"}