Difference between revisions of "Multi Color LED (use with mDesigner)"

From Microduino Wiki
Jump to: navigation, search
(Target ColorLED)
(ColorLED - Set Color Transition)
 
(7 intermediate revisions by the same user not shown)
Line 134: Line 134:
 
==ColorLED - Set Color Transition==
 
==ColorLED - Set Color Transition==
 
This block causes the target ColorLED to smoothly transition from the first color to the second color over the specified duration of time.<br>
 
This block causes the target ColorLED to smoothly transition from the first color to the second color over the specified duration of time.<br>
'''Note:''' This block is holding, which means the transition must complete before the program goes to the next block in the script.
+
{| class="wikitable" style="background-color:#FEF9E7;"
 +
|'''Note:''' This block is holding, which means the transition must complete before the program goes to the next block in the script.
 +
|}
 
::[[File:MDesigner_ColorLED_Set_Color_Transition.png]]
 
::[[File:MDesigner_ColorLED_Set_Color_Transition.png]]
 +
:*'''Pin Number''' - the pin number the ColorLED is connected to. See [[#Target ColorLED]]
 +
:*'''Index''' - the index of the target ColorLED. See [[#Target ColorLED]] section.
 +
:*'''From Color'''- the color to transition from. Can use the '''ColorLED - Color''' block instead. See [[#ColorLED - Color]]
 +
:*'''To Color'''- the color to transition to. Can use the '''ColorLED - Color''' block instead. See [[#ColorLED - Color]]
 +
:*'''Duration'''- the amount of time in '''milliseconds''' to transition from the '''From Color''' to the '''To Color'''.
  
 
==ColorLED - Color==
 
==ColorLED - Color==
Line 141: Line 148:
  
 
::[[File:MDesigner_ColorLED_Color.png]]
 
::[[File:MDesigner_ColorLED_Color.png]]
 +
 +
:*'''Red Value'''- the amount of red to turn on. Valid values are 0 to 255. 0 Being off, 255 fully on, 127 half on.
 +
:*'''Green Value'''- the amount of green to turn on. Valid values are 0 to 255. 0 Being off, 255 fully on, 127 half on.
 +
:*'''Blue Value'''- the amount of blue to turn on. Valid values are 0 to 255. 0 Being off, 255 fully on, 127 half on.
 +
  
 
This block is used by dragging it into the "Color Selection" part of either the '''ColorLED - Set Color''' or '''ColorLED - Set Color Transition'''.
 
This block is used by dragging it into the "Color Selection" part of either the '''ColorLED - Set Color''' or '''ColorLED - Set Color Transition'''.
 +
::[[File:MDesigner_ColorLED_Color_Replacement.png]]

Latest revision as of 16:25, 8 June 2018

The Multi Color LED is a light producing trinket which consist of 3 tiny LEDs of different colors (red, green, and blue). Each color can be set to different brightness levels. Combinations of various brightness levels for these colors can produce a wide variety of colors when mixed. Support for this trinket is found in mDesigner.

Compatible Pins

The following pins on the Hub or mCenter+'s Hub support this module:

Hub Digital Pins v2-01.png
Pin Name Compatibility Notes
Pin 0 Yes Not recommended, Pin 0 & 1 used by mDesigner (serial communication).
Pin 1 Yes Not recommended, Pin 0 & 1 used by mDesigner (serial communication).
Pin 2 Yes
Pin 3 Yes
Pin 4 Yes
Pin 5 Yes
Pin 6 Yes
Pin 7 Yes
Pin 8 Yes
Pin 9 Yes
Pin 10 Yes
Pin 11 Yes
Pin 12 Yes
Pin 13 Yes
Pin A0 Yes
Pin A1 Yes
Pin A2 Yes
Pin A3 Yes
Pin A6 Yes
Pin A7 Yes
Pin I2C No


Connectivity

Connecting 1 ColorLED is simply done by attaching a Hub Connector Wire to a pin on the Hub and the other end to the IN port of the ColorLED.


Similarly, additional ColorLEDs can be connected by attaching to different pins on the Hub. But this method can waste a lot of pins which could be used for other sensors or trinkets.


The ColorLED trinket has been designed to connect multiple ColorLEDs one after the other. This is called "daisy chaining. The method works as outlined:

  • Use a Hub Connector Wire and connect one end a pin on the Hub. Connect the other end into the labeled IN port on a ColorLED.
  • Use a Hub Connector Wire and connect one end to the previous ColorLED's OUT port. Connect the other end to the IN port of a new ColorLED.
  • Use a Hub Connector Wire and connect one end to the previous ColorLED's OUT port. Connect the other end to the IN port of another new ColorLED.
  • Repeat until the desired amount of ColorLEDs are attached.

Target ColorLED

When using the blocks below, the target ColorLED is the one to modify or interact with. A ColorLED attached to a project is addressed by the pin number and the index.

  • Pin number is the labeled pin that the ColorLED (or the first in the string of ColorLEDs) is attached to on the Hub. All ColorLEDs in a chain will have the same pin number, since the first in the chain is attached to the Hub at that pin number.
  • Index refers the location that particular ColorLED is in a chain.
    • The ColorLED connected directly to the Hub has an index of 0.
    • The ColorLED connected to the previous one will have an index of 1.
    • The ColorLED connected to the previous one will have an index of 2.
    • And so forth.

Blocks

ColorLED - Set Color

This block sets the target ColorLED to the selected color.

MDesigner ColorLED Set Color.png
  • Pin Number - the pin number the ColorLED is connected to. See #Target ColorLED
  • Index - the index of the target ColorLED. See #Target ColorLED section.
  • Color- the color to set the target ColorLED to. Can use the ColorLED - Color block instead. See #ColorLED - Color

ColorLED - Set Color Transition

This block causes the target ColorLED to smoothly transition from the first color to the second color over the specified duration of time.

Note: This block is holding, which means the transition must complete before the program goes to the next block in the script.
MDesigner ColorLED Set Color Transition.png
  • Pin Number - the pin number the ColorLED is connected to. See #Target ColorLED
  • Index - the index of the target ColorLED. See #Target ColorLED section.
  • From Color- the color to transition from. Can use the ColorLED - Color block instead. See #ColorLED - Color
  • To Color- the color to transition to. Can use the ColorLED - Color block instead. See #ColorLED - Color
  • Duration- the amount of time in milliseconds to transition from the From Color to the To Color.

ColorLED - Color

This block defines a specific color based on the amount of red, green, and blue. Numeric values between 0 and 255 can be set for each of the individual colors.

MDesigner ColorLED Color.png
  • Red Value- the amount of red to turn on. Valid values are 0 to 255. 0 Being off, 255 fully on, 127 half on.
  • Green Value- the amount of green to turn on. Valid values are 0 to 255. 0 Being off, 255 fully on, 127 half on.
  • Blue Value- the amount of blue to turn on. Valid values are 0 to 255. 0 Being off, 255 fully on, 127 half on.


This block is used by dragging it into the "Color Selection" part of either the ColorLED - Set Color or ColorLED - Set Color Transition.

MDesigner ColorLED Color Replacement.png