So that works but the effect is really slow, where do I control the speed of the light chase to it's target? I'm also having issues with changing the width of it. I don't understand the comment that says 3/2 = 1.5. Can you help clarify what that means?
Edit, Figured out the speed of the light chasing. Just trying to figure out the width of the phaser.
You can change a lot of the effect with changing the "byte". On page 1 you can find a post from Hans where he has written down all bytes, what they mean and what change will do what.
If you want to change the width of the phaser, you can change "byte PhaserWidth" which is the amount of LED´s running down to the aim point. If you want to change the width of the shooting effect then change "byte ShootingWidth"
As you can see in the code, the loop contains the parameters and "void strartrek_phaser" contains the corresponding definitions (I have colorised it).
void loop()
{
startrek_phaser( 0xff, 0x90, 0, -1, 4, 4, 10, 20, 60, 40); // TargetLED = -1 = random pick
delay(1000); // delay between phase shots
}
void startrek_phaser(byte PhaserRed, byte PhaserGreen, byte PhaserBlue, int TargetLED,
byte PhaserWidth, byte ShootingWidth, int msAimDelay,
int PulsateAmount, int msPulsateDelayBright, int msPulsateDelayDarker)
Here is the list of parameters:
PhaserRed, PhaserGreen, PhaserBlue: define the color of the LEDs (0xff, 0x90, 0 = orange).
TargetLED: The LED at what position needs to be "fired" (use "-1" for a random position).
PhaserWidth: the number of LEDs used to "walk" to the aiming position. 4 seemed nice.
ShootingWidth: the number of LEDs used when "firing" and here 3 or 4 seems nice.
msAimDelay: the milliseconds delay between each step when "walking" to the firing position (less = faster), 10 seemed good here.
PulsateAmount: how many times the phaser needs to pulse when firing - I picked 20.
msPulsateDelayBright: the milliseconds delay while "firing" before going to a darker color (less = shorter), 60 seemed good.
msPulsateDelayDarker: the milliseconds delay while "firing" before going to a brighter color (less = shorter), 40 seemed good.
Since you may want to tweak this as well, I've defined 3 values (didn't want to add even more parameters to the function);
DimmingPhaserAim: the amount the outer LEDs will dim while aiming
DimmingShoot: the amount the outer LEDs will dim when firing
DimmingPulsing: the amount the outer LEDs will dim when pulsating while firing.
Note: When the phaser is made of an odd number of LEDs (for example "3"), then the middle LED will be the bright one.
When the phaser is made of an even number of LEDs (>3) then the middle 2 LEDs will be bright.