Eyes | lrf.eyes
The Little Robot Friends have two RGB (red green blue) LEDs (light emitting diodes). By using the following functions, the eyes can be set to a number of different colors or color patterns. You can set the color to a variety of preset colors or you can create your own using RGB values.
Functions called from within the "eyes" portion of the library have the prefix of lrf.eyes
getLeft()
Description
The function returns the color value of the left eye.
Examples
myColorValue = lrf.eyes.getLeft;
Syntax
getLeft()
Parameters
none
Returns
LRFColorValue
Notes
none
getRight()
Description
The function returns the color value of the right eye.
Examples
myColorValue = lrf.eyes.getRight;
Syntax
getRight()
Parameters
none
Returns
LRFColorValue
Notes
none
set()
Description
This function sets both LED eyes to a specific color, provided by the user as Red, Green and Blue values.
Examples
lrf.eyes.set(120,50,250);
Syntax
set(redValue, greenValue, blueValue)
Parameters
-
redValue
: unsigned char - red color value (max 255) -
greenValue
: unsigned char - green color value (max 255) -
blueValue
: unsigned char - red color value (max 255)
Returns
none
Notes
none
setLeft()
Description
This function sets the left side LED eye to a specific color, provided by the user as Red, Green and Blue values.
Examples
lrf.eyes.setLeft(120,50,250);
Syntax
setLeft(redValue, greenValue, blueValue)
Parameters
-
redValue
: unsigned char - red color value (max 255) -
greenValue
: unsigned char - green color value (max 255) -
blueValue
: unsigned char - red color value (max 255)
Returns
none
Notes
none
setRight()
Description
This function sets the right side LED eye to a specific color, provided by the user as Red, Green and Blue values.
Examples
lrf.eyes.setRight(120,50,250);
Syntax
setRight(redValue, greenValue, blueValue)
Parameters
-
redValue
: unsigned char - red color value (max 255) -
greenValue
: unsigned char - green color value (max 255) -
blueValue
: unsigned char - red color value (max 255)
Returns
none
Notes
none
setColor()
Description
This function sets both LED eyes to a specific color, provided by the user as a LRFColor type.
Examples
lrf.eyes.set(LRFColor_Green);
Syntax
setColor(color)
Parameters
color
: LRFColor type - The color to set the eyes to.
Returns
none
Notes
none
setLeftColor()
Description
This function sets the left side LED eye to a specific color, provided by the user as a LRFColor type.
Examples
lrf.eyes.setLeftColor(LRFColor_Yellow);
Syntax
setLeftColor(color)
Parameters
color
: LRFColor type - The color to set the eyes to.
Returns
none
Notes
none
setRightColor()
Description
This function sets the right side LED eyes to a specific color, provided by the user as a LRFColor type.
Examples
lrf.eyes.setRightColor(LRFColor_Orange);
Syntax
setRightColor(color)
Parameters
color
: LRFColor type - The color to set the eyes to.
Returns
none
Notes
none
blinkColor()
Description
This function illuminates both LED eyes a specific color and duration if specified. If no duration is provided by the user, the default value of 500 ms is used. This function can be both blocking and non-blocking, depending on the use of the optional "blocking" parameter.
Examples
Basic:
lrf.eyes.blinkColor(LRFColor_Pink);
Advanced:
lrf.eyes.blinkColor(LRFColor_Pink, 650, true);
Syntax
blinkColor(color)
blinkColor(color, duration, blocking)
Parameters
-
color
: LRFColor type - The color to set the eyes to. -
duration
(optional) : unsigned int - This sets the duration of the "blink". The default value is 500 ms. -
blocking
(optional) : bool - Sets whether the function is blocking or not. The default value is false.
Returns
none
Notes
none
blinkPattern()
Description
This function illuminates both LED eyes in a pattern of colors. This function can be both blocking and non-blocking, depending on the use of the optional "blocking" parameter.
Examples
Basic:
lrf.eyes.blinkPattern(myPattern); //play pattern
Advanced:
lrf.eyes.blinkPattern(myPattern, true); //play pattern and enable blocking
Syntax
blinkPattern(pattern)
blinkPattern(pattern, blocking)
Parameters
-
pattern
: LRFPattern type - The eye pattern that the user wants to animate. -
blocking
(optional) : bool - Sets whether the function is blocking or not. The default value is false.
Returns
none
Notes
none
blinkPatterns()
Description
This function illuminates both LED eyes in a pattern of colors. This function can be both blocking and non-blocking, depending on the use of the optional "blocking" parameter.
Examples
Basic:
lrf.eyes.blinkPattern(*myPatterns); //play pattern
Advanced:
lrf.eyes.blinkPattern(*myPatterns, true); //play pattern and enable blocking
Syntax
blinkPatterns(patterns)
blinkPatterns(patterns, blocking)
Parameters
-
pattern
: LRFPattern* type - A pointer to the eye pattern that the user wants to animate. -
blocking
(optional) : bool - Sets whether the function is blocking or not. The default value is false.
Returns
none
Notes
This function makes use of the pointer symbol. *