4lightingandsoundcontrol, 42 pgmⅢ programmable ethernet control system – CREATOR CR-PGMIII User Manual
Page 49

CREATOR CHINA 2011-03
WWW.CREATOR1997.COM
42
PGMⅢ Programmable Ethernet Control System
displayed in character array. Note: 0x8 is
not supported currently
if(DATA. Data[0]==1)
{
ON_RELAY(CRNET_RELAY,3);
}
else if(DATA. Data[0]==0)
{
OFF_RELAY(CRNET_RELAY,3);
}
}
}
7.9.4 Lighting and Sound Control
DEFINE_DEVICE
tp_1 = T:20:TP;
// define the touch panel
device with the ID of 20
CRNET_VOL = N:4:VOL;
//define the
sound control device with the CRNET ID of 4
CRNET_light = N:5:LITE;
//define the
lighting control device with the CRNET ID of 5
DEFINE_VARIABLE
int cr_light;
//define
the
brightness
variable of the CRNET lighting control device
int cr_vol;
//define the volume
variables of the CRNET sound control device
DEFINE_EVENT
// between the time interval of pressing down
tp_1
buttons and bouncing up, the codes within
the REPEAT block will be executed repeatedly,
i.e., press to turn on the 1 way of the CRNET_
BUTTON_EVENT(tp_1,52)
{
REPEAT()
{
cr_light=cr_light+100;
if(cr_light>65535)
{
cr_light=65535;
}
SEND_LITE(CRNET_light,1,cr_light);
}
}
// same as above, brightness reduce
BUTTON_EVENT(tp_1,53)
{
REPEAT()
{
SEND_LITE(CRNET_light,1,cr_light);
cr_light=cr_light-100;
if(cr_light<0)
{
cr_light=0;
}
}
}
// same as above, brightness reduces
BUTTON_EVENT(tp_1,50)
{
REPEAT()
{
SET_VOLTOTOL(CRNET_VOL,1,(cr_vol));
SET_VOLTOTOL(CRNET_VOL,2,(cr_vol));
cr_vol=cr_vol+100;
if(cr_vol>65535)
{
cr_vol=65535;
}
}
}