Skip to content

This Python3 script uses a PS4 Gamepad clone to drive 2 DC motors on a scratchbuilt Tank. The computer is a PI3B+ using Ubuntu Server 20.04 for Pi

Notifications You must be signed in to change notification settings

RocketCityDynamics/BluetoothGamepad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Bluetoothgamepad.py

This script operates 2 small DC motors through RPI 3B+ GPIO pins and qty1 L298N motor controller. It enables the joysticks and buttons on a PS4 clone to operate a small tank treaded hobby vehicle with reasonable speed and safety.

Tank treads travel backward and forward independently, creating forward or rearward movement and enabling turning.

Snippets from this script were reused in the Mycroft voice skills also listed in this repo.

Note: Turning action in this script is very sharp, like a pivot in place. Moving left or right is an OPPOSITE rotation of the DC drive motors, NOT a braking of one motor and running of another. The motors don't spin very fast and appear to handle the sudden reversals of direction rather easily.

There are more buttons than there are features to just the 2 DC motors. Other parts of the joystick can be coded for custom functions in this script. Action buttons default to braking. The directional pad and both joysticks drive fairly intuitively like a gently programmed RC should. The front L1/R1 triggers might be the most instinctive to use as brakes when driving.

About

This Python3 script uses a PS4 Gamepad clone to drive 2 DC motors on a scratchbuilt Tank. The computer is a PI3B+ using Ubuntu Server 20.04 for Pi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages