Module: MatrixCreator::Everloop

Defined in:
lib/matrix_creator/everloop.rb,
lib/matrix_creator/everloop/color.rb,
lib/matrix_creator/everloop/pulse.rb,
lib/matrix_creator/everloop/spinner.rb,
lib/matrix_creator/everloop/animation.rb

Overview

Module: Everloop

Communicate with the Everloop driver

Defined Under Namespace

Modules: Color Classes: Animation, Pulse, Spinner

Constant Summary collapse

EVERLOOP_CONFIG =

Configuration values for the Everloop driver

MatrixCreator.settings[:devices][:everloop]
BASE_PORT =

Base port to send data to Everloop driver

EVERLOOP_CONFIG[:port]

Class Method Summary collapse

Class Method Details

.modify_color(color) ⇒ Object

Change the color of all of the Leds on the Everloop driver

Examples:

Change leds using predetermined color

MatrixCreator::Everloop.modify_color(MatrixCreator::Everloop::Color::GREEN)

Change leds using custom

MatrixCreator::Everloop.modify_color({ r: 5, g: 3, b: 9, w: 0 })

Parameters:

  • color (Hash)

    with the rgb+w values for the color



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/matrix_creator/everloop.rb', line 32

def self.modify_color(color)
  everloop_comm = MatrixCreator::Comm.new(BASE_PORT)

  # Generate 35 instances of LedValue with the same color
  image = (1..35).map do
    MatrixMalos::LedValue.new(red: color[:r], green: color[:g],
                              blue: color[:b], white: color[:w])
  end

  everloop_image = MatrixMalos::EverloopImage.new(led: image)
  msg = MatrixMalos::DriverConfig.new(image: everloop_image)
  everloop_comm.send_configuration(msg)

  everloop_comm.destroy
end