Constants change during runtime


#1

At the beginning of the piston, the values for brightness, color and the status (on/off) are written to constants. Then the lamp is dimmed in a loop. When the loop is finished, the old state of the lamp should be restored. For this purpose, the values from the constants are used, which now contain different values than at the beginning of the pistons.
Why do constants change?

Thank you for helpful answers.


#2

Pistons only implement waits, and similar delays in fades, as loops in the code if they are less than five seconds and there will still be ten seconds of execute time available when they end. Otherwise the piston sets a timer and exits so it can start a new instance. That new instance will initialise the constants again.


#3

Hi orangebucket

thank you very much for the answer. I tried a version without waits and get the same problem. The variables seem to be overwritten during runtime. Also the messages in the bottom if are sent multiple times. Is it possible to have the commands executed only once?