.. currentmodule:: omc048 .. _omc048.led: class LED ========= The LED object controls the color of the led in manual mode. WARNING: When the LED object is used the automatic status indication using the LED is disabled. Constructor ----------- .. class:: omc048.LED() Create an LED object associated with the LED. Methods ------- .. method:: LED.colour([colour]) -> integer Get or set the colour of the led. When no parameter is given the current colour is returned as integer value. - ``colour`` Can be one of the following strings or integers: - ``blue`` (0) - ``green`` (1) - ``cyan`` (2) - ``red`` (3) - ``purple`` (4) - ``yellow`` (5) - ``white`` (6) .. method:: LED.off() Turn the LED off. .. method:: LED.on() Turn the LED on, to it's previous colour. .. method:: LED.toggle() Toggle the LED between on and off. The LED remembers it's previous colour when toggled on/off. Examples -------- The following code shows an example with the LED switching between 2 colors. :: import omc048 import time led = omc048.LED() while True: led.colour('blue') time.sleep(1) led.colour('red') time.sleep(0.5) The following code shows an example with the LED running through the preset colours. :: import omc048 import obs start = obs.millis() led = omc048.LED() count = 0 while True: if obs.elapsed_millis(start) > 1000: led.colour(count) count += 1 if count == 6: count = 0 start = obs.millis()