Overhead lights demo


This tutorial demonstrates the different methods for operating the overhead lights and illustrates the commands needed for the seven LED light colours available - red, green, blue, yellow, cyan, magenta, white. The overhead lights are approximately 300-400 lux. It is also possible to adjust the brightness of the overhead lights using the Zcommand when the lights are plugged into specific ports on the top box.

Top

Overhead lights via CN3B

This code is for when the overhead lights are plugged into the socket CN3B on the upper board of the top box. 

SET(GPO6,1) #RED LED 
SET(GPO6,0) 
 
SET(GPO7,1) #GREEN LED 
SET(GPO7,0)
 
SET(GPO8,1) #BLUE LED 
SET(GPO8,0) 

SET(GPO#,1) turns on the specified LED when a 1 is placed after the comma. SET(GPO#,0) turns off the specified LED when a 0 (zero) is placed following the comma. Through turning the primary LED colours on and off in varying combinations, you can create the additive LED light colours.

  • GP06 controls the RED LED
  • GP07 controls the GREEN LED
  • GP08 controls the BLUE LED
Top

CN3B example script


The following code can be copied and pasted into a Zanscript to operate the overhead lights when plugged into CN3B on the upper board of the top box.

ACTION MAIN
 
#OFF 
 SET(GPO6,0) 
 SET(GPO7,0) 
 SET(GPO8,0) 
 WAIT(1) 
 
#RED 
 SET(GPO6,1) 
 SET(GPO7,0) 
 SET(GPO8,0) 
 WAIT(1) 
 
#GREEN 
 SET(GPO6,0) 
 SET(GPO7,1) 
 SET(GPO8,0) 
 WAIT(1) 
 
#BLUE 
 SET(GPO6,0) 
 SET(GPO7,0) 
 SET(GPO8,1) 
 WAIT(1) 
 
#YELLOW 
 SET(GPO6,1) 
 SET(GPO7,1) 
 SET(GPO8,0) 
 WAIT(1) 
 
#MAGENTA 
 SET(GPO6,1) 
 SET(GPO7,0) 
 SET(GPO8,1) 
 WAIT(1) 
 
#CYAN 
 SET(GPO6,0) 
 SET(GPO7,1) 
 SET(GPO8,1) 
 WAIT(1) 
 
#WHITE 
 SET(GPO6,1) 
 SET(GPO7,1) 
 SET(GPO8,1) 
 WAIT(1) 
 
COMPLETE
Top

Overhead lights via CN3A

This code is for when the overhead lights are plugged into the socket CN3A on the upper board of the top box.

SET(GPO3,1) #RED LED 
SET(GPO3,0) 
 
SET(GPO4,1) #GREEN LED 
SET(GPO4,0) 
 
SET(GPO5,1) #BLUE LED 
SET(GPO5,0) 

SET(GPO#,1) turns on the specified LED when a 1 is placed after the comma. SET(GPO#,0) turns off the specified LED when a 0 (zero) is placed following the comma. Through turning the primary LED colours on and off in varying combinations, you can create the additive LED light colours.

  • GP03 controls the RED LED
  • GP04 controls the GREEN LED
  • GP05 controls the BLUE LED
Top

CN3A example script


The following code can be copied and pasted into a Zanscript to operate the overhead lights when plugged into CN3A on the upper board of the top box.

ACTION MAIN
 
#OFF 
 SET(GPO3,0) 
 SET(GPO4,0) 
 SET(GPO5,0) 
 WAIT(1) 
 
#RED 
 SET(GPO3,1) 
 SET(GPO4,0) 
 SET(GPO5,0) 
 WAIT(1) 
 
#GREEN 
 SET(GPO3,0) 
 SET(GPO4,1) 
 SET(GPO5,0) 
 WAIT(1) 
 
#BLUE 
 SET(GPO3,0) 
 SET(GPO4,0) 
 SET(GPO5,1) 
 WAIT(1) 
 
#YELLOW 
 SET(GPO3,1) 
 SET(GPO4,1) 
 SET(GPO5,0) 
 WAIT(1) 
 
#MAGENTA 
 SET(GPO3,1) 
 SET(GPO4,0) 
 SET(GPO5,1) 
 WAIT(1) 
 
#CYAN 
 SET(GPO3,0) 
 SET(GPO4,1) 
 SET(GPO5,1) 
 WAIT(1) 
 
#WHITE 
 SET(GPO3,1) 
 SET(GPO4,1) 
 SET(GPO5,1) 
 WAIT(1) 
 
COMPLETE 
Top

Overhead lights via CN7 or CN8

You may choose to plug the overhead lights into CN7 or CN8 if you need the overhead lights to be dimmer than when plugged into CN3A or CN3B.

This code is for when the overhead lights are plugged into the socket CN7 on the lower board of the top box.

LIGHTS(LIGHT15,RED)
LIGHTS(LIGHT15,GREEN) 
LIGHTS(LIGHT15,BLUE) 
LIGHTS(LIGHT15,YELLOW) 
LIGHTS(LIGHT15,MAGENTA) 
LIGHTS(LIGHT15,CYAN) 
LIGHTS(LIGHT15,WHITE) 
 
LIGHTS(LIGHT15,ON) 
LIGHTS(LIGHT15,OFF)

LIGHTS(LIGHT15,colour_name) turns on the external light as the colour named after the comma. Using LIGHTS(LIGHT15,ON) will turn on the overhead light as white.

Top

CN7 example script


The following code can be copied and pasted into a Zanscript to operate the overhead lights when plugged into CN7 on the lower board of the top box.

ACTION MAIN
 
 LIGHTS(LIGHT15,RED)
 WAIT(1)
 
 LIGHTS(LIGHT15,GREEN)
 WAIT(1)
 
 LIGHTS(LIGHT15,BLUE)
 WAIT(1)
 
 LIGHTS(LIGHT15,YELLOW)
 WAIT(1) 
 
 LIGHTS(LIGHT15,CYAN) 
 WAIT(1) 
 
 LIGHTS(LIGHT15,MAGENTA) 
 WAIT(1) 
 
 LIGHTS(ALL,OFF) 
 
COMPLETE
Top

This code is for when the overhead lights are plugged into the socket CN8 on the lower board of the top box.

LIGHTS(LIGHT16,RED)
LIGHTS(LIGHT16,GREEN)
LIGHTS(LIGHT16,BLUE)
LIGHTS(LIGHT16,YELLOW)
LIGHTS(LIGHT16,MAGENTA)
LIGHTS(LIGHT16,CYAN)
LIGHTS(LIGHT16,WHITE)
 
LIGHTS(LIGHT16,ON)
LIGHTS(LIGHT16,OFF)

LIGHTS(LIGHT16,colour_name) turns on the overhead light as the colour named after the comma. Using LIGHTS(LIGHT16,ON) will turn on the overhead light as white.

Top

CN8 example script


The following code can be copied and pasted into a Zanscript to operate the overhead lights when plugged into CN8 on the lower board of the top box. 

ACTION MAIN
 
 LIGHTS(LIGHT16,RED)
 WAIT(1)
 
 LIGHTS(LIGHT16,GREEN)
 WAIT(1)
 
 LIGHTS(LIGHT16,BLUE)
 WAIT(1)
 
 LIGHTS(LIGHT16,YELLOW) 
 WAIT(1)
 
 LIGHTS(LIGHT16,CYAN) 
 WAIT(1)
 
 LIGHTS(LIGHT16,MAGENTA)
 WAIT(1)
 
 LIGHTS(ALL,OFF)
 
COMPLETE
Top

External light clip

The external light can be plugged into CN7 or CN8 on the lower board of the top box and will use the same coding as for the overhead lighting to operate.

Top

ZCOMMAND and Intensity 

The ZCOMMAND can be used when the overhead lights are plugged into CN6, CN7 or CN8 to change the light colour, turn lights off and change the light intensity. 

The elements of a ZCOMMAND that can be used to control the overhead lights are as follows:

'P' Pause, to set delay between operations (ms)
  • "P" operation command is used to add a delay in milliseconds between operation commands. It can be used between any of the other parameters below.
'N' Choose light socket & colour (CN number, RGB colour code)
'F' Turn light off (CN number)
'I' Set light intensity (intensity)

The following codes set which socket on the top box is being used (CN6, CN7 or CN8), the colour of the overhead light (in RGB), followed by a Pause of 100 milliseconds and then turns the light off. 

ZCOMMAND("N1#7 P100 F1") 
ZCOMMAND("N2#1 P100 F2") 
ZCOMMAND("N3#2 P100 F3")
  • The "N" operation command uses two arguments: the number before the # sets which light is being referred to and the number following sets its colour.
    • The number prior to the # symbol can be 1, 2, or 3 and refers to the CN output the lights are plugged into.
      • CN8 = 1
      • CN7 = 2
      • CN6 = 3
    • The number following the # symbol uses the RGB code in a range of 0-7.
      • 0 = No colour/Off
      • 1 = Red
      • 2 = Green
      • 4 = Blue
    • To create the remaining LED colours, it uses a LED additive model and therefore:
      • 3 = Yellow
      • 5 = Magenta
      • 6 = Cyan
      • 7 = White

NOTE: CN6 only controls the Red and Green (and therefore Yellow).

  • The "F" operation command turns off the light referenced (e.g., F2 turns Light 2 or the lights plugged into CN7 off.
  • An alternative way of turning off the lights within ZCOMMAND is by using a 0 following the # symbol (e.g., "N1#0").

The following code changes the light intensity and therefore the brightness with a pause of 500 milliseconds between changes.

LIGHTS(ALL,ON) 
ZCOMMAND("I0 P500 I50 P500 I100 P500 I150 P500 I200 P500 I255 P500") 
LIGHTS(ALL,OFF)
  • The "I" operation command is the light intensity value. It uses a range between 0-255 and affects all LEDs.
  • The command is controlling the current to the LEDs and therefore when using ½ the current (i.e, ~I127), you will have ½ brightness. Using the full current (I255) will result in the brightest level.
  • The LEDs need to be plugged into CN6, CN7, or CN8 to control the intensity.

NOTE: An intensity of 0 does not turn the LEDs off completely.


ZCOMMAND example script 

The below example script is for the overhead lights plugged into CN8 only (N1#). The code can be copied and pasted into Zanscript to operate the overhead lights when plugged into CN8 on the lower board of the top box.

ACTION MAIN

#Blue on > Pause 200ms > half brightness > Pause 200ms > Blue off 
ZCOMMAND("N1#4 P200 I127 P200 F1")

WAIT(1)

#Red on > Pause 600ms > Green on > Pause 600ms > Blue on 
ZCOMMAND("N1#1 P600 N1#2 P600 N1#4")

WAIT(1)

#Yellow on > reduce intensity 500ms apart > off
ZCOMMAND("N1#3 P500 I200 P500 I150 P500 I100 P500 I50 P500 I25 P500 F1")

WAIT(1)

#Alternatively if you want wait times longer than 1 second 
#you can use a WAIT command 
#White on > WAIT 1 sec > half brightness > WAIT 1 sec > OFF

LIGHTS(LIGHT16,WHITE)
WAIT(1) 
ZCOMMAND("I127")
WAIT(1)
LIGHTS(LIGHT16,OFF)

COMPLETE
Top

Script download

To download the overhead_lights script as a .zs file (file type Zantiks software reads), choose the Save File As option in the right-click dialogue box. Clicking on the script name hyperlink will open a read-only version of the script.

Script download:
overhead_lights_demo.zs