jordan / Blog: Recent posts

How to negate Boolean values within a case statement

What I am trying to do is turn the lights on and off every time I press a button. I am using the case statement so when I add a keypad to this system
I can simply add x case statement type in x number to pull up or start from that spot.

My lights are not turning on but my while loop is starting when the button is being pressed.

WHILE NOT start DO
    FOR i:=1 TO 2 BY 1 DO
        commands[i]:=(i);
        CASE i OF
            1: up := TRUE;

            2: down := TRUE;
        END_CASE;
    END_FOR;
END_WHILE

Thanks! ... read more

Posted by jordan 2021-10-29