# Video VBOX Logical Operators

Video VBOX Scene setup explained...

Let's say you want to control a display range element (for example changing a RED image to GREEN image) depending on multiple variables... Now you can by using the logical operators in Video VBOX Setup.

So I want to change my picture from RED (which is assigned to the value of 0) to GREEN (which is assigned to the value of 1) when my vehicle speed is greater than 50kph.

I would write the expression like this...

gt('G5',50)

By breaking this expression down it should make a bit more sense:
gt is the function name, in this case it stands for 'greater than'.
'G5' is the channel name, in this case it's Speed.
50 is the toggle speed, in this case it is 50 (kph).

Note: formatting is very important. If it is not correct the maths channel will not work. For example look at the separating comma in the function brackets!

Now this channel is made you can assign this to a display range, bar graph and so on...

Ok now you understand the basics lets move on to something a little more advanced.

Let's say I want the channel to change from 0 to 1 depending on multiple conditions, in this case speed is 50kph or greater and there are 5 satellites or more in view. The expression will look something like this...

and(gte('G5',50),gt('G0',5))

By breaking this expression down it should make a bit more sense:
gte is a the function name, in this case it stands for 'greater than or equal'.
gt is another function name, in this case it stands for 'greater than'.
and is another function name, in this case 'logical and'.
'G5' is a channel name, in this case its Speed.
'G0' is another channel name, in this case its Satellites.

Note: Again formatting is very important, ensure the opening and closing brackets are positioned in the expression correctly!

So now this channel will only toggle from 0 to 1 when speed is greater than 50kph and there are 5 or more satellites or more in use by the Video VBOX.

This is not limited to GPS channels, you can also use CAN channels and input module channels. For example you may would want a display range picture to go from RED to GREEN when oil pressure is above x Bar and oil temperature is above y °C

### Truth Tables

A= Input
B= Input
C= Output
0= False
1= True

AND OR XOR NOT A B C A B C A B 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 1 0 1 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 1 1 1 1 1 1 1 0 1 1 1