MATLAB Examples

setLedsExact

Set the colour for one of the 16 LEDs on Engduino, other LEDs will be turned off

Contents

Syntax

e.setLedsExact(led,colour);

Description

e.setLedsExact(led,colour) Set the colour for one of the 16 LEDs on Engduino, other LEDs will be turned off

Examples

  • Set the colour of one LED
  • Connect to Engduino on port 3 and set the Colour of LED_0 to green

    % Colours are defined in engduino object as:
    %     COLOR_RED =     0
    %     COLOR_GREEN =   1
    %     COLOR_BLUE =    2
    %     COLOR_YELLOW =  3
    %     COLOR_MAGENTA = 4
    %     COLOR_CYA =     5
    %     COLOR_WHITE =   6
    %     COLOR_OFF =     7
    
    % Check if the Engduino object already exists. Otherwise initialize it.
    if (~exist('e', 'var'))
            e = engduino();
    end
    e.setLedsExact(0,e.COLOR_GREEN);
    

    Input Arguments

    led integer range from 0 to 15 representing the LEDs on Engduino
    colour Can be an integer value of 0-7 or use the colour properties in Engduino object

    Output Arguments

    res Return status to indicate whether function has been executed (int) 0: OK, <0: Error code

    Properties