Example

codesys.com Ingo
Attachments
Game-Preview.png (6867 bytes)
Pong-Schaltplan.PNG (83789 bytes)
Pong.PNG (89448 bytes)

Preface

In this tutorial you will install Pong on your Raspberry Pi. It can be played with two physical controllers on a web-visualisation. This example uses two KY040 rotary encoders as input. But you can use virtually every analog input as the input controlers.

Prerequisites

  • Computer with CODESYS Development System V3 with CODESYS Control for Raspberry Pi SL form the CODESYS-Store
  • Any Raspberry Pi (CODESYS V3.5.11.0 or later). For more Information look at the description
    of CODESYS Control for Raspberry Pi SL in the CODESYS-Store.
  • 2x KY040 - Rotary Encoder
  • 10x jumper wire (maybe different colors)
  • LAN-Cable
  • Project files

Hardware:

  • Connect both KY040s to the Raspberry Pi as it is shown in the following images:


Connect the your Pi to the network and power it up.

Software

After opening CODESYS Development System V3 and adding the CODESYS Control for Raspberry Pi SL,
go to Tools -> Library Repository and Install the library, you have downloaded.

Go to Tools -> Update Raspberry Pi and scan in your network for Raspberry Pis and choose the correct one.

Now connect to your Raspberry Pi. Therefor double click on "Device" and choose on the new window your Raspberry Pi as your controller.

By pressing Alt + F8 you log in. Now start (F5).

In your browser, visit the URL <ip of="" your="" pi="">:8080/webvisu.htm*.</ip>

Game instructions

Press the button on one KY040 to start the game. The player who reaches 13 points first wins.


Related

Home: Home
Home: IndexMain