Documentation > nControl > API Reference
Introduction
These tiles are intended to control LEGO® double crossovers (set 7996-1) with our crossover motors. It's not intended for 4DBrix™ double crossovers. Our double crossovers have 4 independent switches and need to be controlled with 4 track switch tiles.
When you click the tile it will change the switch by executing the flipSwitch() function unless you customize the mouse click event with a your own procedure.
Event Scripts
Crossover tiles support the following event scripts:
API Functions
Tile Specific Functions
nCrossoverTile.clickTile()
Simulates a mouse click on the tile; this executes the mouse click event script.
nCrossoverTile.flipSwitch()
Flips the switch; if the switch in the 'left' position it flips it to the 'right' position and vice versa.
nCrossoverTile.flipSwitchRandom()
Flips the switch to a random position.
nCrossoverTile.getState()
Returns the current state of the switch: nConst.ST_LEFT or nConst.ST_RIGHT.
nCrossoverTile.setSwitchLeft()
Flips the switch to the 'left' position.
nCrossoverTile.setSwitchRight()
Flips the switch to the 'right' position.
Inherited from nTile
nCrossoverTile.clearScreen() Clear all the text in the console window. nCrossoverTile.getTile(label) Returns the tile object specified by label. If there is no tile with the specified label, the function returns a None value. nCrossoverTile.print(text) Prints text in the console window. If the console window it not yet visible, printing text will make it visible. nCrossoverTile.showConsole(mode) Shows (mode = True) or hides (mode = False) the console window. nCrossoverTile.sleep(duration) Stops the execution of the script for the the given number of seconds. Note that duration can be a floating point number, e.g. to suspend the script for half a seconds use self.sleep(0.5). nCrossoverTile.timestamp() Returns the number of seconds that passed since nControl™ was launched. It returns a floating point value with the highest possible time resolution supported by your system. The difference between two time stamps provides the number of seconds elapsed between those two events. nCrossoverTile.localVars Base property to which you can add local variables that retain their value after the event script finishes. For example self.localVars.myVar = 5 adds a new property myVar to self.localVars and gives it the value 5. The localVars property is local to the current tile meaning that each tile has its own independent localVars property. nCrossoverTile.globalVars Base property to which you can add global variables that retain their value after the event script finishes. For example self.globalVars.myVar = 5 adds a new property myVar to self.globalVars and gives it the value 5. The globalVars property is global to nControl meaning that all tiles use the same globalVars property. As such globalVars can be used to exchange information between the tiles. |