module MatrixCreator::Everloop

Module: Everloop

Communicate with the Everloop driver

Constants

BASE_PORT

Base port to send data to Everloop driver

EVERLOOP_CONFIG

Configuration values for the Everloop driver

Public Class Methods

modify_color(color) click to toggle source

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

@param color [Hash] with the rgb+w values for the color

@example Change leds using predetermined color

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

@example Change leds using custom

MatrixCreator::Everloop.modify_color({ r: 5, g: 3, b: 9, w: 0 })
# 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