ANY-maze Help > The ANY-maze reference > The Protocol page > The elements of a protocol > Inputs and outputs > On/off outputs > Setting up an on/off output > Setting on/off output activation options

Setting on/off output activation options

In brief

You can use the option on the on/off output's settings page to specify when the output should be activated.

As well as these options, you can also control the output using a procedure, something which is described in more detail below.

Specifying when the on/off output should be activated

Clearly, if you've included an on/off output in your protocol it's because you want to turn something on and/or off during the tests - but when should this thing turn on? In some cases, the answer may simply be 'when the test starts'; but in other cases you may want to do more sophisticated things, perhaps turning it on and off as the animal moves into different zones.

Activating the output at the start of the test

For the simple case of activating the output at the start of the test, you can use the option here (in the protocol's on/off output settings). This doesn't mean you can't also use a procedure (perhaps to switch it off again); it just means that when the test starts, the output will be activated.

Activating the output based on more complex rules

In this case, you should use a procedure to activate (and/or deactivate) the output. Full details are beyond the scope of this help topic, as it rather depends on what you want to do, but as an example, the procedure in figure 1 will wait until the animal enters the 'Target zone' and will then activate the 'Stimulus' on/off output. More details can be found in the Introduction to procedures.

  

  

Figure 1. This simple procedure will activate the 'Stimulus' on/off output when the animal enters the 'Target' zone.

Activating the output BEFORE the test starts (legacy option)

In versions of ANY-maze prior to 5.20, there was an option to activate an on/off output before the test began (i.e. when the test was 'Ready'). If you used this option, and you open your experiment or protocol in version 5.20 (or later), then you will find that the option is still displayed and it will still work in the same way as it did previously. However, if you turn the option off, then it will disappear from the settings and you won't be able to turn it back on again.

In version 5.20 (and later), if you want to activate a switch before the test starts then the best method is to create a procedure to do this; as can be seen in figure 2, this is very simple.

  

  

Figure 2. This one-statement procedure will activate the 'Stimulus' on/off output before the test starts (because statements in the orange-shaded area are performed as soon as the test is ready)

The key point here is that statements in the orange-shaded area at the top of the procedure editor are performed as soon as the test is ready. So, if you add an Action statement (to activate an on/off output) to this area, then the output will be activated before the test begins.

Preventing the output being reset at the end of the test

When a test ends, ANY-maze will turn the output off and reset it to the values entered on the on/off output's settings page. However, there are circumstances when you might not want this to occur, for example:

 1.You might not want the output to change state until after you remove the animal from the apparatus. Perhaps the output is controlling a light and you don't want the light to switch off while the animal is still in the cage.  
 2.You might be planning to run tests back-to-back, and whatever the state was at the end of one test, you want to continue in the next one. So if a light was on at the end of one test, you may want it to still be on at the start of the next one.  
 3.You might have used a procedure to alter some aspects of a pulse output; for example, the procedure may have changed the pulse frequency during the test. If the switch is reset at the end of the test, then the frequency will be reset to whatever the standard frequency is (as defined in the switch's settings in the protocol), but what if you want to retain the frequency set by the procedure (so it's used in the next test)?  

The option Don't reset the output at the end of the test would appear to be the solution to these requirements, but in fact in most case it will only actually be suitable for situation #1. For #2 and #3 selecting it probably won't have quite the effect you'd expect:

 •The state would be retained from one test to the next, but not from one trial to the next. For example, imagine that your test schedule is such that you will test animal 1 in its first trial, then animal 2 in its first trial and then animal 1 in its second trial, etc. What would happen is that after animal 1's first trial the state of the outputs (i.e. the open/closed state of the doors) would remain the same and so this would be the state that would apply to animal 2's first trial... which is probably not what you want. 
 •Even if the above didn't apply (for example, in your schedule you might test animal 1 four times in a row), then if you exited ANY-maze after trial 2 and then restarted it again, the state of the outputs would be lost.  

The best way to ensure that an on/off output's state is retained from one trial to the next (even if you close the experiment, exit ANY-maze and turn off your computer between tests) is to use a procedure; this is described in detail here.

See also:

 •An introduction to procedures 

© Copyright 2003-2026 Stoelting Co. All rights reserved

ANY-maze help topic T0193