Multiple clicks configuration

Grenton System gives the opportunity to create any connections between input and output devices and also to prepare advanced logic adapted to user's needs. One of such functionalities is the ability to control multiple circuits by the use of one button. It is possible thanks to the functionality of recognizing the time of pressing on the key and multiple clicks. Below there is presented a proposition of realizing double-clicks support.


To realize the below functionality you will need:


The realization of the aforementioned functionality will require the creation of:

  • script - in the exemplary project named config
  • Virtual Object TIMER- in the exemplary project named timer
  • a global variable that holds the number of clicks – in the exemplary project named clicks_number

The configuration of CLU central unit

1. Double-click on CLU icon to go to the module settings:

 

2. Go to "Embedded features" tab and create a global variable of number type:

  • clicks_number - the number of clicks counted

 

Logic configuration

1. Create a script for managing work. In the analysed case named config:


2. Create a script realizing the logic of the system through the use of Components tray at the left side of the Object Manager Software window. The information on how to create scripts in Grenton System is available HERE. The connections and conditions between functional blocks should look as shown in the below scheme:



Below there is a full list of components and the procedure of creating them.

  • Condition > CLU > Defined Features: clicks_number > Logic Condition: "==" > Value: 1
        Checking if the number of counted clicks is 1

  • Action > lamp1 > Methods: Switch(time) > Parameters: Unlimited
        Change of the relay output status of lamp1

  • Operations on variables > clicks_number > "=" > Value: 0
        Assigning the number of clicks value 0

  • Condition > CLU > Defined Features: clicks_number > Logic Condition: "==" > Value: 1
        Checking if the number of counted clicks is 2

  • Action > lamp2 > Methods: Switch(time) > Parameters: Unlimited
        Change of the relay output status lamp2

  • Operations on variables > clicks_number > "=" > Value: 0
        Assigning the number of clicks value 0


The above logic in text mode is presented as below:

if(CLU->clicks_number==1) then 
CLU->lamp1->Switch(0)
CLU->clicks_number=0
else
if(CLU->clicks_number==2) then
CLU->lamp2->Switch(0)
CLU->clicks_number=0
else
CLU->clicks_number=0
end
end


ATTENTION! This logic may be simply broadened to recognize a larger number of clicks. Just add subsequent conditions checking clicks number. The exemplary extension of triple-click is presented below:

 

Virtual object TIMER

1. Click on the clock symbol to go to the window of creating virtual objects:




2. Choose "Timer" from the drop-down list:




3. Go to "Embedded features" tab, set Mode feature into CountDown mode and enter the value of Time feature – the time in which the subsequent clicks should be made, be counted by the system:




4. Go to the "Events" tab, add the created config script to OnTimer event:


5. Confirm the changes with OK button.

 

The configuration of input/output devices

1. Double-click on the input icon switch to go to the module input settings:




2. Go to the "Events" tab and assign two commands to the OnClick event:

  • Launching the work of virtual object timer:

  • Execution of iterative increase of global variable clicks_number value

This command may be assigned in different ways, however, the fastest and the simplest is the edition of generated command to the form correctly interpreted by Inbuilt LUA language compiler. In the field “Assigning the command” add the subsequent position and type by hand:

CLU->clicks_number+=1

or:

CLU->clicks_number=CLU->clicks_number+1

 

It is also possible to replace the command typed by hand with a script. To do this, create the script as below:



Assigning the creation of this script to the OnClick event:

 

After the performed operation, the dialogue window of switch input in Events tab is presented as below:



Instead of using instruction:

CLU->clicks_number+=1

you can use:

CLU->increment()



3. Confirm the changes with OK button.

 

Sending the configuration to the system

1. After entering all changes, send the configuration to CLU by using the below button on the toolbar: