{"library":"node-red-node-pi-gpio","title":"Pi GPIO for Node-RED","description":"The node-red-node-pi-gpio package provides a set of Node-RED nodes for interacting with the General Purpose Input/Output (GPIO) pins of a Raspberry Pi. Utilizing the `RPi.GPIO` Python library, it enables flow-based control and monitoring of digital and Pulse Width Modulation (PWM) outputs, as well as digital inputs. The current stable version is 2.0.7. Releases appear to follow a milestone-based cadence rather than a strict schedule, with major version updates incorporating new features or significant changes. Key differentiators include built-in support for mouse and keyboard input detection and direct integration into the Node-RED visual programming environment, simplifying hardware interaction for IoT and automation projects on Raspberry Pi devices. It specifically notes an alternative, `node-red-node-pi-gpiod`, for more accurate servo control, indicating this package is better suited for general purpose digital and basic PWM applications.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install node-red-node-pi-gpio"],"cli":null},"imports":["Install via Node-RED palette manager or `npm i node-red-node-pi-gpio`","Install via Node-RED palette manager or `npm i node-red-node-pi-gpio`","Install via Node-RED palette manager or `npm i node-red-node-pi-gpio`"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"/*\n  This quickstart demonstrates how to install 'node-red-node-pi-gpio' and describes a basic Node-RED flow setup.\n  Since this is a Node-RED node package, direct JavaScript runtime usage is not applicable.\n  The instructions guide you through setting up a simple input-to-debug and inject-to-output flow in the Node-RED editor.\n*/\n\n// Step 1: Install the Node-RED node package.\n// You should run this command in your Node-RED user directory (typically ~/.node-red)\n// or use the 'Manage Palette' option within the Node-RED editor.\nconsole.log(\"Executing installation command:\\n  npm i node-red-node-pi-gpio\\n\");\n\n// After installation, restart Node-RED if prompted or if nodes do not appear in the palette.\nconsole.log(\"Installation complete. If nodes are not visible, restart Node-RED (e.g., 'node-red-start').\\n\");\n\n// Step 2: Configure a basic flow in the Node-RED editor (usually accessible at http://localhost:1880).\nconsole.log(\"--- Node-RED Flow Configuration Guide ---\");\nconsole.log(\"1. Drag an 'rpi gpio in' node from the palette onto your flow canvas.\");\nconsole.log(\"   - Double-click the 'rpi gpio in' node: Select a BCM GPIO number (e.g., 4) and configure pull-up/down resistors if needed.\");\nconsole.log(\"2. Drag a 'debug' node onto the canvas.\");\nconsole.log(\"   - Connect the output of the 'rpi gpio in' node to the input of the 'debug' node.\");\nconsole.log(\"   - When the state of GPIO 4 changes, you will see '0' or '1' in the debug sidebar.\");\nconsole.log(\"3. Drag an 'inject' node onto the canvas.\");\nconsole.log(\"   - Double-click the 'inject' node: Set 'Payload' to a number (e.g., 1 for digital high, or 50 for 50% PWM).\");\nconsole.log(\"4. Drag an 'rpi gpio out' node onto the canvas.\");\nconsole.log(\"   - Double-click the 'rpi gpio out' node: Select a BCM GPIO number (e.g., 17) and choose 'Digital output' or 'PWM output' mode.\");\nconsole.log(\"5. Connect the output of the 'inject' node to the input of the 'rpi gpio out' node.\");\nconsole.log(\"   - Clicking the 'inject' node's button will now set the state of GPIO 17.\");\nconsole.log(\"6. Click the 'Deploy' button in the Node-RED editor to activate your flow.\");\n\n// Note: On non-Raspbian systems, additional Python library and Udev rules setup is required. (Refer to warnings for details).\n","lang":"javascript","description":"Describes the installation process and guides a user through creating a basic Node-RED flow with Pi GPIO Input, Output, and Debug/Inject nodes.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}