Class: Led

Inherits:
Object
  • Object
show all
Defined in:
lib/led.rb

Instance Method Summary collapse

Instance Method Details

#check_led(temp, set, range) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/led.rb', line 4

def check_led(temp, set, range)
    if(temp < (set - range))
        @color = "0000FF".colorize(:blue)
        @fcolor = "0000FF"
    elsif(temp > (set + range))
        @color = "FF0000".colorize(:red)
        @fcolor = "FF0000"
    else
        @color = "00FF00".colorize(:green)
        @fcolor = "00FF00"
    end
end

#get_colorObject



21
22
23
# File 'lib/led.rb', line 21

def get_color
    return @fcolor
end

#get_fcolorObject



25
26
27
# File 'lib/led.rb', line 25

def get_fcolor
    "The LED is #{@fcolor}"
end

#get_ledObject



17
18
19
# File 'lib/led.rb', line 17

def get_led
    "The LED is #{@color}"
end