Sha256: 47088410de8c57cbc9ebf4e7f8059b72d32caab8b10168c901aef213f2818f4b

Contents?: true

Size: 971 Bytes

Versions: 1

Compression:

Stored size: 971 Bytes

Contents

require 'launchpad_mk2'

interaction = Launchpad::Interaction.new

# yellow feedback for grid buttons
interaction.response_to(:grid) do |interaction, action|
  	interaction.device.change(:grid, :x => action[:x], :y => action[:y], :color => 72)
end

# red feedback for top control buttons
interaction.response_to([:up, :down, :left, :right, :session, :user1, :user2, :mixer]) do |interaction, action|
  interaction.device.change(action[:type], :color => 13)
end

# green feedback for scene buttons
interaction.response_to([:scene1, :scene2, :scene3, :scene4, :scene5, :scene6, :scene7, :scene8]) do |interaction, action|
  interaction.device.change(action[:type], :color => 16)
end

# mixer button terminates interaction on button up
interaction.response_to(:mixer, :up) do |interaction, action|
	interaction.device.reset_all()
  interaction.stop
end

# start interacting
interaction.start

# sleep so that the messages can be sent before the program terminates
sleep 0.1

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
launchpad_mk2-0.0.1 examples/feedback.rb