CODESYS Asteroid Shooter -
Article no.000028
Asteroid Shooter
The game Asteroid Shooter shows how
to connect a joystick to the Soft PLC CODESYS
Control Win V3 and
how to use visualization and object oriented programming in CODESYS.
Attention: 64 Bit controls are not supported.
Product description
The example Asteroids. project shows
with help of the game Asteroids how to connect a joystick
to the Soft PLC CODESYS Control Win V3.
For this purpose the IoDrvJoystickWin.dll must be on the control.
The example also shows the
effective usage of object oriented programming and visualization in CODESYS.
More information
Joystick: The device Joystick uses the
channels X, Y, Z, R, U, V and Buttons (see IO-Mapping).
These channels can be assigned to existing variables directly. The mapping of
the channels depends on the type
of the joystick and must be adapted if necessary.
PLC_PRG: The Sequencial
Function Chart (SFC) contains the processing logic of the program.
CollisionManager: Function
block to register potential collision objects and to check collisions.
EventController: Mapping of
the keyboard and joystick events.
Every moving object on the
screen has its own function block and visualization.
These objects are derived from MovingObject.
The library asteroids_help_library contains
some necessary mathematical functions.
Important Information
In order to make this example
work, the CODESYS Control CFG file has to be extended. Change in your
CODESYS installation folder to GatewayPLC/. Open the file CODESYSControl.cfg and add new component as IoDrvJoystickWin. See the
screenshot below. Additionally, copy the file IoDrvJoystickWin.dll from the
package into the same folder.
In CODESYS go to Tools -> Device Repository... -> Install. Now select the
file Joystick000000011.0.0.0900.devdesc.xml, which is also included into the
package.