Skip to content

Commit c1fb0d7

Browse files
committed
Started instructions in README.md
1 parent 07472e6 commit c1fb0d7

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
# python-connect-ps4
22
Using Python to connect to a PS4 and a map of all identified events.
33

4-
<table width="100%">
4+
This code was written to connect a LEGO EV3 Brick to a PS4 controller. The EV3 is running [ev3dev](https://www.ev3dev.org/) and running a version of Python called [Pybricks](https://github.com/pybricks/pybricks-micropython). However, the code reacting to the PS4 controller events and the mapping of different buttons should apply to any Python/PS4 project.
5+
6+
This code assumes that the PS4 controller has already been paired.
7+
8+
## Event Files
9+
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).
10+
11+
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:
12+
13+
* /dev/input/event2 (touchpad events)
14+
* /dev/input/event3 (controller movement, like tilting, etc...)
15+
* /dev/input/event4 (buttons, sticks, etc...)
16+
17+
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:
18+
19+
** Touchpad Events
20+
21+
For me touchpad events were found in /dev/input/event2.
22+
23+
<table>
524
<tr><th>Event</th><th>Code</th><th>Possible Values</th><th>Description</th></tr>
625
</table>
26+
27+
<a href="https://codeadam.ca">
28+
<img src="https://codeadam.ca/images/code-block.png" width="100">
29+
</a>

0 commit comments

Comments
 (0)