Johnaspl
Published © CC BY-NC-SA

Creating a Game Controller using Arduino Uno and Python

How to craft a game controller utilizing Arduino Uno and Python.

IntermediateFull instructions provided436
Creating a Game Controller using Arduino Uno and Python

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Sparkfun push button
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Resistor 1k ohm
Resistor 1k ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE
Crazyflie Python Client
Bitcraze Crazyflie Python Client

Story

Read more

Code

Python Code

Python
import serial
from pynput.keyboard import Controller as KeyboardController

print("Greetings! Welcome to NBox 100")

print("""Please provide the COM port of your controller.
You can locate this information in the Device Manager under the COM & LPT section.
Identify your device by unplugging and then plugging it back in.
Enter it as follows:
Example: COM8
""")

ser = serial.Serial(input(">>"), 9600)

print("Connection established")

keyboard = KeyboardController()

while True:
data = ser.readline()

Credits

Johnaspl
1 project • 2 followers

Comments