Skip to content

codeadamca/ev3-python-ps4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

python-connect-ps4

Using Python to connect to a PS4 and a map of all identified events.

This code was written to connect a LEGO EV3 Brick to a PS4 controller. The EV3 is running ev3dev and running a version of Python called Pybricks. However, the code reacting to the PS4 controller events and the mapping of different buttons should apply to any Python/PS4 project.

This code assumes that the PS4 controller has already been paired.

Event Files

When the PS4 is paried with the device it creates three event files. These files are updated when the PS4 controller experiecnes an event (such as a button press).

Using a terminal check out the contents of the /dev/input folder before and after you pair the Bluetooth device. You should notice three new event files. On my device these files where:

  • /dev/input/event2 (touchpad events)
  • /dev/input/event3 (controller movement, like tilting, etc...)
  • /dev/input/event4 (buttons, sticks, etc...)

Each event provides five values, but we only need the event ID, code, and value. Here is a list of all events I could find:

** Touchpad Events

For me touchpad events were found in /dev/input/event2.

EventCodePossible ValuesDescription

About

Using Python to connect the LEGO EV3 brick to a PS4 controller.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages