This may not be of help, as it's been a long time for me too, but I always just used variables to count up and down. Variable1 to contain the count value and Variable2 to contain the increment amount. I simple if statment can toggle the increment amount (Variable2) from 1 to -1 once Variable1 reaches a high or low value.
Use the Count (Variable1) to move your arm.
The only drawback is not using actual seconds for timing. Maybe you can use a timer that calls another code tab (forgot what their called) that executes the code.
Wish I could be more specific but I'm not where I can write and test it.