But I can not figure out what you were doing and what kind of help you need.

Please describe in detail what you want to do and how can we help!

Check out the previous example if you just need to make a triangle wave.

y=f(x,t) increasing when (t%T) < T/2 and decreasing when (t%T)>T/2