Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (19 sloc) 0.752 kb
require 'launchpad'
interaction = Launchpad::Interaction.new
flags = Hash.new(false)
# yellow feedback for grid buttons
interaction.response_to(:grid, :down) do |interaction, action|
coord = 16 * action[:y] + action[:x]
brightness = flags[coord] ? :off : :hi
flags[coord] = !flags[coord]
interaction.device.change(:grid, action.merge(:red => brightness, :green => brightness))
end
# mixer button terminates interaction on button up
interaction.response_to(:mixer) do |interaction, action|
interaction.device.change(:mixer, :red => action[:state] == :down ? :hi : :off)
interaction.stop if action[:state] == :up
end
# start interacting
interaction.start
# sleep so that the messages can be sent before the program terminates
sleep 0.1
Jump to Line
Something went wrong with that request. Please try again.