https://github.com/johnmccabe/blinkt-ruby
Ruby port of Pimoroni Blinkt Python module https://github.com/pimoroni/blinkt
https://github.com/johnmccabe/blinkt-ruby
blinkt blinkt-library blinkt-ruby leds library pimoroni pimoroni-blinkt-python raspberry-pi raspberrypi ruby ruby-port
Last synced: 4 months ago
JSON representation
Ruby port of Pimoroni Blinkt Python module https://github.com/pimoroni/blinkt
- Host: GitHub
- URL: https://github.com/johnmccabe/blinkt-ruby
- Owner: johnmccabe
- License: mit
- Created: 2016-09-18T23:13:45.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-20T07:19:48.000Z (over 9 years ago)
- Last Synced: 2025-01-16T09:14:24.719Z (about 1 year ago)
- Topics: blinkt, blinkt-library, blinkt-ruby, leds, library, pimoroni, pimoroni-blinkt-python, raspberry-pi, raspberrypi, ruby, ruby-port
- Language: Ruby
- Size: 24.4 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README

A Ruby port of the [Pimoroni Blinkt Python library](https://github.com/pimoroni/blinkt).
[](https://badge.fury.io/rb/blinkt)
Blinkt provides eight super-bright RGB LED indicators, ideal for adding visual notifications to your Raspberry Pi on their own or on a pHAT stacking header.
Available from Pimoroni: https://shop.pimoroni.com/products/blinkt
## Installation
The Blinkt library can be installed from Rubygems:
# gem install blinkt
## Usage
The two Blinkt methods you'll most commonly use are `set_pixel` and `show`. Here's a simple example:
```
require 'blinkt'
set_pixel(0,255,0,0)
show
```
`set_pixel` takes an optional fifth parameter; the brightness from 0.0 to 1.0.
`set_pixel(pixel_no, red, green, blue, brightness)`
You can also change the brightness with `set_brightness` from 0.0 to 1.0, for example:
```
require 'blinkt'
set_brightness(0.5)
show
```
It is also possible to clear any already lit pixels with `clear`, set all pixels at once with `set_all` and to have all pixels clear on exit with `set_clear_on_exit`.
```
require 'blinkt'
clear
set_clear_on_exit
set_all(255,0,0)
show
```
`set_all` takes an optional fourth parameter; the brightness from 0.0 to 1.0.
`set_all(red, green, blue, brightness)`
## Examples
The examples in the `examples` folder should just work with Blinkt!
## Version Information
The Ruby Blinkt gem version corresponds to the Python lib versions in the following table:
| Ruby Gem Version | Python Lib Version |
| ---------------- | ------------------ |
| 0.0.3 | [0.1.0](https://github.com/pimoroni/blinkt/tree/3c493b85745d8a850dce60a3933cc71a3b8aa789) |