Spybots Smart Parts  
  The Unofficial Resource Centre for Lego Spybotic  
   
img  
   
   

TUTORIALS

TUTORIALS

BASIC

Lighting Up (Part 3)- nqc

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

BACK

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.

 

This tutorial is protected by International Intellectual Property Rights laws and may not be reproduced or redistributed in full or part, without the prior written consent of the author. Unauthorized reproduction of this tutorial or its contents may result in prosecution.

 

 
 
DISCLAIMER: All content is provided as is, with no warranty stated or implied regarding the quality or accuracy of any content on or off this site. All trademarks, service marks, and copyrights are property of their respective owners. This site is not sponsored, authorized or sanctioned by the LEGO Group nor representative of their opinions in any way.PRIVACY POLICY