En esta lección aprenderemos a utilizar scripts en WinCC RT para controlar el color de un rectángulo. A veces necesitas C-Action en tiempo de ejecución; es importante saber cómo hacerlo correctamente.
Pregunta de un suscriptor
"¿Puedes hacer un video de cambio de color con 3 condiciones en C? Día A=1 → verde, Día B=1 → rojo, Día C=1 → amarillo y parpadeante".
Script C (sin flashear)
// WINCC:TAGNAME_SECTION_START
// syntax: #define TagNameInAction "DMTagName"
// next TagID : 2
#define TAG_1 "TagA"
#define TAG_2 "TagB"
#define TAG_3 "TagC"
// WINCC:TAGNAME_SECTION_END
// WINCC:PICNAME_SECTION_START
// syntax: #define PicNameInAction "PictureName"
// next PicID : 1
// WINCC:PICNAME_SECTION_END
if (GetTagBit(TAG_1) & GetTagBit(TAG_2) & GetTagBit(TAG_3))
return 64255;
else if (GetTagBit(TAG_1) & GetTagBit(TAG_2))
return 255;
else if (GetTagBit(TAG_1))
return 65280;
else
return 0;TagA=1 da como resultado verde (65280), TagA+TagB en rojo (255), los tres en amarillo (64255). El flasheo se agrega en el Tutorial n.° 70.
Un aviso: Video tutorial detallado arriba.