Sha256: 1618e3f993a66f1096fc7cdc248110ad03cc27f6e00ea95e7355f4ef0449898a
Contents?: true
Size: 1002 Bytes
Versions: 1
Compression:
Stored size: 1002 Bytes
Contents
#!/usr/bin/env ruby # require "bignum" require "rubygems" require "bundler/setup" Bundler.require(:default, :development) require "launchpad" def init_board(interaction) (0..7).each do |x| (0..7).each do |y| interaction.device.change_grid(x, y, 0x00, x + 0x10, y + 0x10) sleep 0.001 end end end def goodbye(interaction) (0..64).step(4).each do |i| ii = 64 - i (0..7).each do |x| (0..7).each do |y| interaction.device.change_grid(x, y, ii, 0x00, ii) sleep 0.001 end end end end interaction = Launchpad::Interaction.new interaction.response_to(:grid) do |inter, action| x = action[:x] y = action[:y] if action[:state] == :down r, g, b = 0x3F, 0x00, 0x00 else r, g, b = 0x00, x + 0x10, y + 0x10 end inter.device.change_grid(x, y, r, g, b) end interaction.response_to(:mixer, :down) do |_interaction, action| puts "STAHP!" goodbye(interaction) interaction.stop end init_board(interaction) interaction.start
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mrjoy-launchpad-0.4.0 | testbed.rb |