Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
node-red-node-pi-gpio
Advanced tools
Readme
A set of Node-RED nodes to interact with Pi GPIO using the RPi.GPIO python library that is part of Raspbian.
It also include a simple node that detect mouse buttons and also keyboard clicks. Note: this picks up mouse keys direct from the keyboard so should work even when the app does not have focus, but YMMV.
If you need servo control then look at the node-red-node-pi-gpiod node as this is a lot more accurate timing wise, and more suitable for driving servos
Either use the Node-RED Menu - Manage Palette option to install, or run the following
command in your Node-RED user directory - typically ~/.node-red
npm i node-red-node-pi-gpio
The python library may also work with other distros running on a Pi (like Ubuntu or Debian) - you will need to install the PIGPIO package and run the following commands in order to gain full access to the GPIO pins as this ability is not part of the default distro. This is NOT necessary on Raspbian.
sudo apt-get install python-pip python-dev
sudo pip install RPi.GPIO
sudo addgroup gpio
sudo chown root:gpio /dev/gpiomem
sudo adduser $USER gpio
echo 'KERNEL=="gpiomem", NAME="%k", GROUP="gpio", MODE="0660"' | sudo tee /etc/udev/rules.d/45-gpio.rules
sudo udevadm control --reload-rules && sudo udevadm trigger
Note: the diagram in the configuration shows pin numbers - the BCM GPIO field allows you to enter the GPIO number directly (this allows you to use the node for other devices that have other BCM GPIO like the Pi Compute modules.)
Generates a msg.payload
with either a 0 or 1 depending on the state of the input pin.
msg.payload
- number - the level of the pin (0 or 1)msg.topic
- string - pi/{the pin number}You may also enable the input pullup resistor ↑ or the pulldown resistor ↓.
Can be used in Digital or PWM modes.
msg.payload
- number | stringtrue/false
)Hint: The range
node can be used to scale inputs to the correct values.
Digital mode expects a msg.payload
with either a 0 or 1 (or true or false),
and will set the selected physical pin high or low depending on the value passed in.
The initial value of the pin at deploy time can also be set to 0 or 1.
When using PWM mode, the input value should be a number 0 - 100, and can be floating point.
FAQs
The basic Node-RED node for Pi GPIO
The npm package node-red-node-pi-gpio receives a total of 2,165 weekly downloads. As such, node-red-node-pi-gpio popularity was classified as popular.
We found that node-red-node-pi-gpio demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.