Nowadays, programmable logic controllers (PLC) are widely used in many automated systems, especially for the control of various actuators. The most common PLC programming is performed by either using a ladder diagram or a structured text. The paper presents the automatic generation of PLC programs for the purpose of sequentially controlling pneumatic actuators. In this paper, the pneumatic actuators are supplied and controlled by 5/2-way as well as 5/3-way bistable pneumatic valves with electric activation. The valve type depends on the number of positions in which the actuator should come, and the position sensors are used for detecting its movement. The characteristic encoding of the movement of actuators, position sensors and control commands is performed. The advantages of the automatic generation of the PLC commands and the entire program described in this paper are illustrated in a real example.