Tutorial Details:
Difficulty Level:
Basic
Topics Covered: Using
in in-built arc light animations using NQC.
Assumed Knowledge:
The Basics, My first program, Using Include, Lighting
Up (Parts 1 & 2)
Written By: BILL LANE
Print Version
So far we've looked at different ways to manually turns the
ARC lights on and off. But that's not the only option. The
Spybot comes pre-programmed with 8 different animation sequences
and there is a very good chance that one of these will be
ideal for use in your mission.
Names for these animations are defined in spy.nqh along with
the function that runs them so you'll need to include that
file at the top of your program. But you don't need the names
to make them work, although they make a lot more sense that
way. I'll list them here so we know what we're talking about:
//LED display effects (0 to 7)
0 ANIMATION_SCAN
1 ANIMATION_SPARKLE
2 ANIMATION_FLASH
3 ANIMATION_RED_TO_GREEN
4 ANIMATION_GREEN_TO_RED
5 ANIMATION_POINT_FORWARD
6 ANIMATION_ALARM
7 ANIMATION_THINKING
We run these animations using SetAnimation(nDisplay). It
looks like this:
#include "spy.nqh"
task main()
{
SetAnimation(0);
Wait(400);
}
The number in the brackets
tells the Spybot which animation to run. As always we use
wait so we get a chance to see the fireworks before the program
ends.
Just change the nDisplay
number to change the animation. You can even call them by
name if you prefer.
|