MIDI Elements
Library to simplify handling of components for MIDI controllers
 All Classes Files Functions Variables Macros
RGBLed Class Reference

Class for handling tri color LEDs. More...

#include <RGBLed.h>

Public Member Functions

 RGBLed (byte pa, byte pb, byte pc)
 constructor with pin number for red, green and blue. More...
 
 RGBLed (byte pa, byte pb, byte pc, byte c, byte n)
 constructor with pin number for red, green, blue, midi channel and midi note. More...
 
 RGBLed (byte pa, byte pb, byte pc, byte c, byte n, bool a)
 constructor with pin number for red, green, blue, midi channel, midi note and PWM. More...
 
 ~RGBLed ()
 
void setOn (byte c, byte n, byte v)
 read the values for note on and cc and update the led state. if the passed channel and number match the the led state is set to v More...
 
void setOff (byte c, byte n, byte v)
 read the values for note off and update the led state. More...
 
void setOnSilent (byte c, byte n, byte v)
 read the values for note on and cc, but do not update the led state. (used for banked LEDs). More...
 
void setOffSilent (byte c, byte n, byte v)
 read the values for note off, but do not update the led state. More...
 
void set (byte s)
 manually set the state, but does not update the LED. More...
 
void set ()
 manually update the LED to the set state (used for banked LEDs) More...
 
void setColor (byte r, byte g, byte b, byte i)
 set the default on color manually. this color will be enabled if the value 127 is received. More...
 

Detailed Description

Class for handling tri color LEDs.

Enable PWM, to set the brightness through velocity or CC, must be on PWM pin and there will be no ability to change colors through velocity values. Default color will be active if velocity 127 is recieved. For any other values colours will cycle through. Intensity will change the PWM write value for different colors.

Constructor & Destructor Documentation

RGBLed::RGBLed ( byte  pa,
byte  pb,
byte  pc 
)

constructor with pin number for red, green and blue.

Parameters
pared led pin number
pbgreen led pin number
pcblue led pin number
RGBLed::RGBLed ( byte  pa,
byte  pb,
byte  pc,
byte  c,
byte  n 
)

constructor with pin number for red, green, blue, midi channel and midi note.

Parameters
pared led pin number
pbgreen led pin number
pcblue led pin number
cmidi channel
nmidi note or cc number
RGBLed::RGBLed ( byte  pa,
byte  pb,
byte  pc,
byte  c,
byte  n,
bool  a 
)

constructor with pin number for red, green, blue, midi channel, midi note and PWM.

Parameters
pared led pin number
pbgreen led pin number
pcblue led pin number
cmidi channel
nmidi note or cc number
aenable PWM
RGBLed::~RGBLed ( )

Member Function Documentation

void RGBLed::set ( byte  s)

manually set the state, but does not update the LED.

Parameters
starget state
void RGBLed::set ( )

manually update the LED to the set state (used for banked LEDs)

void RGBLed::setColor ( byte  r,
byte  g,
byte  b,
byte  i 
)

set the default on color manually. this color will be enabled if the value 127 is received.

Parameters
ramount of red color
gamount of green color
bamount of blue color
iintensity amount for the non default colors
void RGBLed::setOff ( byte  c,
byte  n,
byte  v 
)

read the values for note off and update the led state.

Parameters
cchannel from callback function
nnote or cc number from callback function
vvalue or velocity from callback function
void RGBLed::setOffSilent ( byte  c,
byte  n,
byte  v 
)

read the values for note off, but do not update the led state.

Parameters
cchannel from callback function
nnote or cc number from callback function
vvalue or velocity from callback function
void RGBLed::setOn ( byte  c,
byte  n,
byte  v 
)

read the values for note on and cc and update the led state. if the passed channel and number match the the led state is set to v

Parameters
cchannel from callback function
nnote or cc number from callback function
vvalue or velocity from callback function
void RGBLed::setOnSilent ( byte  c,
byte  n,
byte  v 
)

read the values for note on and cc, but do not update the led state. (used for banked LEDs).

Parameters
cchannel from callback function
nnote or cc number from callback function
vvalue or velocity from callback function

The documentation for this class was generated from the following files: