Friday, June 12, 2015

Mobile Game Controller Using Python

This post is to show how to communicate between mobile and computer, and its one such project that combines a lot of stuffs from Wifi commmunication to keyboard user input. This is can be achieved through python and kivy and along with some other packages. When I surfed the net I saw people doing some gesture controlled powerpoint presentation which involves an accelerometer.I thought of doing something with the accelerometer not just for controlling presentations but for controlling games. Since I did not have an accelerometer I used my phone's accelerometer to control the game.I designed an app using kivy which collects the phone's accelerometer data and sends it to the computer, the computer processes the information received and generates key input events
If you would like to know how to use your mobile's accelerometer and transfer its data to your computer you can read this.

Lets move on. !!

First of all this project requires:

  • Python 2.7 in your computer.
  • QPython on your mobile or you can package the app and intsall it in your mobile. I just directly coded in my mobile itself.
  • Win32api for your computer 
  • For simplicity download PyUserInput
  • And finally a mobile having an accelerometer
Link for Downloading Python 2.7.

Link for Downloading Win32api. Download the one that suits your python version if it displays an error message during installation then you have downloaded the wrong version.
I used Kivy for creating the app. My friend Raamakrishnan created a windows phone app for the same. Refer the link below to for the code..

The app looks like this:



The code has been posted in the github 
#IIEE

1 comment: