kamil_szczepan:
unfortunately in my target code the variable "delay time" is read from int (lcd encoder)
I have no idea what that means. If you got the code you posted in reply #8 it would be a start. As has been said before, change the value in the periods array instead of changing the value of val2. Once that works you can apply the principle to your target program. It does not matter where the timing variable comes from, it just needs to be put in the right place in the periods array