Documentation > nControl > API Reference
Up-Down Tile
nControl™ 2021.0
The Up-Down tile is a generic control tile.
Introduction
The tile has three buttons: up, down and stop. It can be used to, for example, control a motor by sending commands to a PU hub or SBrick tile. The tile has a value and is increased with the Up button, decreased with the Down button and set to zero with the Stop button. The tile also has a upper and lower limit on the value that cannot be exceeded.
Event Scripts
Up-Down tiles support the following event scripts:
  • Activate tile event: is executed when the tile is activated by switching to simulation of operational mode.
  • Deactivate tile event: is executed when the tile is deactivated by switching to design of configuration mode.
  • Mouse click event: is executed when the user clicks on the tile.
  • Mouse release event: is executed when the user releases the mouse on the tile.
API Functions
Tile Specific Functions
nUpDownTile.clickTile(zone)
Simulates a mouse click on the tile; this executes the mouse click event script.
  • zone: specifies the mouse click zone where the virtual click is appeared:
    • zone = 0: simulates a click outside the defined zones
    • zone = 1: simulates a click in the 'up' zone
    • zone = 2: simulates a click in the 'down' zone
    • zone = 3: simulates a click in the 'stop' zone
nUpDownTile.getMouseClickZone()
Returns the zone that received the last mouse click:
  • 0 = the tile has not received any mouse clicks yet or the last click was outside the predefined zones
  • 1 = the 'up' zone
  • 2 = the 'down' zone
  • 3 = the 'stop' zone
nUpDownTile.getValue()
Returns the current value of the tile.
nUpDownTile.setMaxValue(value)
Defines the upper bound on the tile value.
  • value: specifies the new upper bound. The new upper bound needs to be higher than the current minimal value. If that is not the case, the upper bound will not be changed. If the current tile value is higher than the provided maximal value, the current value will be set to new maximal value.
nUpDownTile.setMinValue(value)
Defines the lower bound on the tile value.
  • value: specifies the new lower bound. The new lower bound needs to be lower than the current maximal value. If that is not the case, the lower bound will not be changed. If the current tile value is lower than the provided minimal value, the current value will be set to new minimal value.
nUpDownTile.setStep(step)
Defines the change of the value when Up or Down button is clicked.
  • step: Specifies the new step value. The step value needs to be a positive non-zero value. When a negative or zero value is provided, the step value will not be changed.
nUpDownTile.setValue(value)
Sets the value of the tile.
  • value: Specifies the new value of the tile. If the value is higher than the upper limit, or lower than the lower limit, it will be set to the value of that limit.
Inherited from nTile
nUpDownTile.clearScreen()
Clear all the text in the console window.
nUpDownTile.getTile(label)
Returns the tile object specified by label. If there is no tile with the specified label, the function returns a None value.
nUpDownTile.print(text)
Prints text in the console window. If the console window it not yet visible, printing text will make it visible.
nUpDownTile.showConsole(mode)
Shows (mode = True) or hides (mode = False) the console window.
nUpDownTile.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).
nUpDownTile.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.
nUpDownTile.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.
nUpDownTile.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.