Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Thomas Jachmann March 02, 2013
file 22 lines (18 sloc) 0.691 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
require 'launchpad'

device = Launchpad::Device.new(:input => false, :output => true)

pos_x = pos_y = 0
4.times do |red|
  4.times do |green|
    device.change :grid, :x => pos_x, :y => pos_y, :red => red, :green => green
    device.change :grid, :x => 7 - pos_x, :y => pos_y, :red => red, :green => green
    device.change :grid, :x => pos_x, :y => 7 - pos_y, :red => red, :green => green
    device.change :grid, :x => 7 - pos_x, :y => 7 - pos_y, :red => red, :green => green
    pos_y += 1
    # sleep, otherwise the connection drops some messages - WTF?
    sleep 0.01
  end
  pos_x += 1
  pos_y = 0
end

# sleep so that the messages can be sent before the program terminates
sleep 0.1
Something went wrong with that request. Please try again.