class Led

Public Instance Methods

color() click to toggle source
# File lib/led.rb, line 23
def color
    @color
end
getColor() click to toggle source
# File lib/led.rb, line 19
def getColor
    "The color of the LED is #{@color}"
end
setColor(value) click to toggle source
# File lib/led.rb, line 3
def setColor(value)
    if value < 0
        conv = value.abs.to_s(16)
        @color = "0000#{conv}"
    end

    if value > 0
        conv = value.abs.to_s(16)
        @color = "#{conv}0000"
    end

    if value == 0
        @color = "00ff00"
    end
end