Spybots Smart Parts  
  The Unofficial Resource Centre for Lego Spybotic  
   
img  
   
   

TUTORIALS

TUTORIALS

BASIC

lighting up (part 3) - mindscript

Tutorial Details:
Difficulty Level: Basic
Topics Covered: Using in in-built arc light animations using Mindscript.
Assumed Knowledge: The Basics, My first program, Using Include, Lighting Up (Part 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 globals.h. So if you want to refer to them by name you'll want to include that file (and spybot.h or you'll get an error message). But you don't need the names to make them work, allow 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)
-1 = ledNone
0 = ledScan
1 = ledSparkle
2 = ledFlash
3 = ledRedToGreen
4 = ledGreenToRed
5 = ledPointForward
6 = ledAlarm
7 = ledThinking

Let's have a look at two ways we can make use of these. The first way, and the most straightforward, is to use display. It looks like this:

program lightUp{

main{
display 3
wait 200
}

}

The number after the word display tells it which animation to run. As always we use wait so we get a chance to see the fireworks before the program ends.

The second option is to use Display_Bead(nDisplay, nTime), which as you can see takes two parameters. The first parameter nDisplay is one of those numbers to tell it which animation to run. The second parameter nTime is how long you want the animation to run. To make this work you'll definitely need to include globals.h and spybot.h. The whole program looks like this:

program lightUp{

#include<spybot.h>
#include<globals.h>

main{
Display_Bead ( 3, 100 )
}

}

Just change the nDisplay number to change the animation. Now you've included globals.h you can even call them by name.

 

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