Beiträge anzeigen

Diese Sektion erlaubt es ihnen alle Beiträge dieses Mitglieds zu sehen. Beachten sie, dass sie nur solche Beiträge sehen können, zu denen sie auch Zugriffsrechte haben.


Nachrichten - Automaty

Seiten: [1]
1
Modulentwicklung / Re: Philips Hue
« am: 06. Januar 2020, 22:09:01 »
Hi Sergej,

Can You Upload Ethernet.lib.

2
Modulentwicklung / Re: Philips Hue
« am: 19. Januar 2019, 17:06:07 »
I have solution. Its not the best thing can be don but best i have made.
Using this batch and NT_StartProcess you can change on/off, hue, saturation, brightness, and temperature color.
It suport some other things but its not working i my PLC

https://github.com/Lanjelin/hue-batch

In 'KEY' you need input your oun hue key.
In PATHSTR and DIRNAME input your dir of bath files.

PROGRAM HUE_bat
VAR_INPUT
lamp2: BOOL;
lamp3: BOOL;
on: BOOL;
hue: DINT;
saturation: INT;
brightness: INT;
color: INT;

END_VAR
VAR
Key: STRING := 'key'; (*Insert Hue Key*)
Start_Process : NT_StartProcess :=( NETID:='',
PATHSTR:='C:\TwinCAT\PLC\Program\BOX\Bat\hue.bat',
DIRNAME:='C:\TwinCAT\PLC\Program\BOX\Bat',
TMOUT:=t#2s);
Pause : TOF:=( PT:=t#1s); (*Wait to execute bat.*)
Trig: R_TRIG;
bStart: BOOL;
CMD: STRING(MAX_STRING_LENGTH);
CMD_Old: STRING(MAX_STRING_LENGTH);
END_VAR

Start_Process(START:=bStart,
COMNDLINE:=CMD);
Pause(IN:=Trig.Q);
Trig;

CMD:=CONCAT('-k ',key);
CMD:=CONCAT(CMD, ' -l "');
IF lamp2 THEN
CMD:=CONCAT(CMD, '2');
END_IF
IF lamp3 THEN
CMD:=CONCAT(CMD, ' 3');
END_IF
CMD:=CONCAT(CMD, '" ');
CMD:=CONCAT(CMD, '-on ');
IF on=TRUE THEN
CMD:=CONCAT(CMD, 'true');
ELSIF on=FALSE THEN
CMD:=CONCAT(CMD, 'false');
END_IF
IF hue>0 THEN
CMD:=CONCAT(CMD, ' -h ');
CMD:=CONCAT(CMD,DINT_TO_STRING(hue));
END_IF
IF saturation>0 THEN
CMD:=CONCAT(CMD, ' -s ');
CMD:=CONCAT(CMD,INT_TO_STRING(saturation));
END_IF
IF brightness>0 THEN
CMD:=CONCAT(CMD, ' -b ');
CMD:=CONCAT(CMD,INT_TO_STRING(brightness));
END_IF
IF color>0 THEN
CMD:=CONCAT(CMD, ' -c ');
CMD:=CONCAT(CMD,INT_TO_STRING(color));
END_IF

Seiten: [1]