Project

cheeky-pi

0.0
No commit activity in last 3 years
No release in over 3 years
EventMachine-friendly library for working with the DreamCheeky Webmail Notifier.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.1.1
~> 1.0.3
 Project Readme

CheekyPi

EventMachine friendly library for working with the DreamCheeky Webmail Notifier.

Installation

Add this line to your application's Gemfile:

gem 'cheeky-pi'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cheeky-pi

Usage

require 'cheeky-pi'
require 'eventmachine'

light = CheekyPi.new.light

EventMachine.run {
  pi.light.color([0, 255, 0])
}

Multiple lights:

pi = CheekyPi.new
light1 = pi.lights[0]
light2 = pi.lights[1]
...
light1.failure
light2.success

Simple animation

CheekyPi.new.light.transition! [255, 0, 255]

Throb animation

#Perpetual throb animation, with a 10 second cycle period
CheekyPi.new.light.throb! [0, 255, 0], [0, 0, 255], 10

Fun with promises

light = CheekyPi.new.light
light.transition!(255, 0, 255).then {
  puts 'animation complete'
  light.throb! 10, [255, 0, 255], [255, 255, 255]
}

Build lights

case some_build_status
  when :build
    light.building
  when :failed
    light.failure
  when :successful
    light.success
  else
    light.off
end

Related gems:

Why?

My raspberry pi could not interact with the webmail notifier via libusb, so this gem depends instead on /sys/devices/*/red|green|blue courtesy of the usbled driver.

Additionally, I wanted (non-blocking) animation for use with a build monitoring tool.