class Led

Public Instance Methods

color() click to toggle source
# File lib/leds.rb, line 21
def color
  @color
end
get_color() click to toggle source
# File lib/leds.rb, line 17
def get_color
  "The LED is #{@color}"
end
set_color(value) click to toggle source
# File lib/leds.rb, line 3
def set_color(value)
  if value < 0
    calc = value.abs.to_s(16)
    @color = "0000#{calc}"
  end
  if value > 0
    calc = value.abs.to_s(16)
    @color = "#{value}0000"
  end
  if value == 0
    @color = "00ff00"
  end
end