Sha256: 0b78b9e40f7c74fb77eeed44ef940615d9483b8f160d4d2e8213d99012bb518a
Contents?: true
Size: 752 Bytes
Versions: 2
Compression:
Stored size: 752 Bytes
Contents
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
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
mrjoy-launchpad-0.4.0 | examples/drawing_board.rb |
launchpad-0.3.0 | examples/drawing_board.rb |