Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to turn on the indicator light when the start button is pressed.
PLC Programming
IF StartButton = [1] THEN
IndicatorLight := TRUE;
END_IF;Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 instead of 1 to check if the button is pressed.
Using FALSE instead of TRUE.
✗ Incorrect
The start button is pressed when its value is 1 (TRUE). So the condition should check if StartButton equals 1.
2fill in blank
mediumComplete the code to turn off the indicator light when the stop button is pressed.
PLC Programming
IF StopButton = [1] THEN
IndicatorLight := FALSE;
END_IF;Attempts:
3 left
💡 Hint
Common Mistakes
Checking for 0 instead of 1.
Assigning TRUE instead of FALSE to IndicatorLight.
✗ Incorrect
The stop button is pressed when its value is 1 (TRUE). So the condition should check if StopButton equals 1.
3fill in blank
hardFix the error in the code to correctly toggle the indicator light when the toggle button is pressed.
PLC Programming
IF ToggleButton = [1] THEN
IndicatorLight := NOT IndicatorLight;
END_IF;Attempts:
3 left
💡 Hint
Common Mistakes
Checking for 0 instead of 1.
Using FALSE instead of TRUE.
✗ Incorrect
The toggle button is pressed when its value is 1 (TRUE). The condition must check for 1 to toggle the light.
4fill in blank
hardFill both blanks to turn on the indicator light only when the start button is pressed and the safety switch is ON.
PLC Programming
IF StartButton = [1] AND SafetySwitch = [2] THEN IndicatorLight := TRUE; END_IF;
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 or FALSE for pressed or ON states.
Using OR instead of AND.
✗ Incorrect
The start button is pressed when it equals 1, and the safety switch is ON when TRUE. Both conditions must be true to turn on the light.
5fill in blank
hardFill all three blanks to turn off the indicator light when the stop button is pressed or the emergency stop is activated.
PLC Programming
IF StopButton = [1] OR EmergencyStop = [2] THEN IndicatorLight := [3]; END_IF;
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 or FALSE for pressed or activated states incorrectly.
Assigning TRUE instead of FALSE to IndicatorLight.
✗ Incorrect
Stop button pressed means 1, emergency stop activated means TRUE, and to turn off the light we assign FALSE.
