Giter VIP home page Giter VIP logo

pygame_space-raiders's Introduction

Pygame Space_Raiders ๐Ÿš€

This is a game that is controlled by the arduino with a JOYSTICK. The game is writen in Python using libraries Pygame and pyserial.

Before running the codes check out the follwing:

1. Setting up the Arduino & Check the Configuration

Connect the Arduino to your computer using a USB cable

Connect the Joystick to the arduino

The +5V and GND on the joystick are connected to the Arduino respectively the same way

Open the Joystick.ino file in the Arduino IDE and check out if:

int JSx = A0; // VRx value on the Jostick is connected to A0 on the Arduino
int JSy = A2; // VRy value on the Jostick is connected to A2 on the Arduino
int JSpin = 9; // Sw value on the Jostick is connected to 9 on the Arduino

After customizing the File Upload it to the Arduino Uno and exit.

2. Install the necesary libraries:

To install pygame in your everonment

pip install pygame

Ton install pyserial in your everonment

pip install pyserial

3. Check the configuration serial

Check this line:

arduinoData = serial.Serial("/dev/ttyACM0", 9600)

You can check the port by:

1.Open the Arduino IDE.

2.Click on Tools in the menu bar and select Port from the drop-down menu.

3.The port that the Arduino is using will be highlighted in the list. Take note of the port number (e.g., COM3).

Alternatively in linux you can check the port number by:

1.Open a terminal window.

2.Run the following command to list all the serial ports:

ls /dev/tty*

3.Look for a port name that starts with /dev/ttyUSB or /dev/ttyACM. The number at the end may vary depending on your system and the number of connected devices.

4.Take note of the port name (e.g., /dev/ttyUSB0 or /dev/ttyACM1) that the Arduino is using.

Running the Project ๐Ÿฅณ

After making sure that all the Files and settings are well configured, you can run the project by running the main.py file using the following command:

python main.py

Or use your Text Editor to run the project if it is capable of doig so! ๐Ÿ˜‚

Check out how it looks ๐Ÿ˜ฑ

The sample output of the awesome game

pygame_space-raiders's People

Contributors

chiesa14 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.