ColorLED_RGB.gph : fade the LED color/on/off of your Control
1 post
• Page 1 of 1
ColorLED_RGB.gph : fade the LED color/on/off of your Control
This header file adds the function
fColorFade(rs,gs,bs, rd,gd,bd, value, mode) to fade/blink the LED RGB color/brightness/on-off state of your controller / Titan Two.
Where rs,gs,bs are the start values 0.0 to 100.0 of the color red,green,blue brightness
and rd,gd,bd the color/brightness to fade to.
value is the number to adjust the colors on each step of fading done.
mode:
0 will run the whole fading once
-1 will repeat it endless from start to end, from end to start, start to end...
-2 will repeat it endless from start to end, from start to end, start to end,
You can use function ColorLED_RGB(<i>r,g,b</i>) to set the color directly without fading effects.
For a working example and more information download the ColorLEDFade_Example from the Online Resource
If you want to change the speed of the combo you can adjust the value of the int16 variable cFadeWait in your script.
Warning: A value too low will cause trouble/disconnects, default is 100ms
The variable iFades tracks the count of blinking or completed adjustment.
You can use this value to check for stop blinking after a specific count.
! Do not call the functions on every interaction of main !
Only call it when you want to change the LED.
If you understand this you will have no trouble with the led, rumble or segment display control functions.
Usage:
Download the Headerfile "ColorLEDFade.gph" from the Online Resource.
Place this file into the same directory where your script file is.
Add this line to your script:
Some examples:
fColorFade(rs,gs,bs, rd,gd,bd, value, mode) to fade/blink the LED RGB color/brightness/on-off state of your controller / Titan Two.
Where rs,gs,bs are the start values 0.0 to 100.0 of the color red,green,blue brightness
and rd,gd,bd the color/brightness to fade to.
value is the number to adjust the colors on each step of fading done.
mode:
0 will run the whole fading once
-1 will repeat it endless from start to end, from end to start, start to end...
-2 will repeat it endless from start to end, from start to end, start to end,
You can use function ColorLED_RGB(<i>r,g,b</i>) to set the color directly without fading effects.
For a working example and more information download the ColorLEDFade_Example from the Online Resource
If you want to change the speed of the combo you can adjust the value of the int16 variable cFadeWait in your script.
Warning: A value too low will cause trouble/disconnects, default is 100ms
The variable iFades tracks the count of blinking or completed adjustment.
You can use this value to check for stop blinking after a specific count.
! Do not call the functions on every interaction of main !
Only call it when you want to change the LED.
If you understand this you will have no trouble with the led, rumble or segment display control functions.
Usage:
Download the Headerfile "ColorLEDFade.gph" from the Online Resource.
Place this file into the same directory where your script file is.
Add this line to your script:
- Code: Select all
#include "ColorLEDFade.gph"
Some examples:
- Code: Select all
// Set all LED off.
ColorLED_RGB(0.0,0.0,0.0);
// Set red LED 50% brightness.
ColorLED_RGB(50.0,0.0,0.0);
// fade from red to green full brightness, adjustment step 5.0 each combo run
fColorFade(100.0,0.0,0.0, 0.0,100.0,0.0, 5.0);
// fade from red to off, adjustment step 5.0 each combo run, repeat pattern start->end,start->end
fColorFade(100.0,0.0,0.0, 0.0,0.0,0.0, 5.0, -1);
// fade from red to off, adjustment step 5.0 each combo run, repeat pattern start->end->start->end
fColorFade(20.0,0.0,0.0, 0.0,0.0,0.0, 5.0, -2);
// fade from red 100% to blue 10% brightness, adjustment step 2.0 each combo run
fColorFade(100.0,0.0,0.0, 0.0,0.0,10.0, 2.0);
// blink green/red
cFadeWait=400; // adjusting the combo wait time in ms, default value of 100ms is too fast for blinking
fColorFade(0.0,100.0,0.0, 100.0,0.0,00.0, 100.0, -1);
// blink green on/off
cFadeWait=400; // adjusting the combo wait time in ms, default value of 100ms is too fast for blinking
fColorFade(0.0,100.0,0.0, 0.0,0.0,00.0, 100.0, -1);
// example to stop repeating fade after 3 times.
// iFades increases each time on fade restart (on->off,on->off == 2 or on->off->on == 3)
if (iFades==3) FadeStop();
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
1 post
• Page 1 of 1
Return to User's Script Documentation
Who is online
Users browsing this forum: Majestic-12 [Bot] and 95 guests