I think what’s in for is the same as what I handwritten 1 to 6 in if statements
But there’s a different move. Where did it go wrong?
The code inside was written by copying and pasting
When I alternated between the two versions, only the ones written in if (from 1 to 6) worked properly
Hi @limhyeonsoo I’m not patient enough to watch all your videos. I would need source code backup on my PC or online meeting for that. But what about to use debugger to step by step your code execution, I think this would help a lot in this case or what do you think? B&R Online Help
→ first of all, your loop iterate from 0 to 5 but your array in watch is from 1 to 6
→ your array values for gxUpButtonPressed as well as for gxDownButtonPressed are FALSE, your condition in IF statement of these button is waiting for TRUE value, so behavior for buttons iteration from 1 to 5 is correct. Condition is not met, content of IF and ELSEIF statement is not executed.
This brings up additional note from me , check how you access arrays items in your code. If you have more lines like that then very likely you are overwriting memory. So behavior will be always weird colleagues here have already provided you nice examples how to do it better (check your previous question).
I thought the syntax of ‘elsif’ wouldn’t work because I didn’t click on ‘upbuttonpress’ number 1
Thanks for the answer, I found it during a quick check while changing my last question
I’ll take a closer look at your answer