You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
557 B
Python
29 lines
557 B
Python
2 years ago
|
import time
|
||
|
import zmq
|
||
|
from pyPS4Controller.controller import Controller
|
||
|
|
||
|
|
||
|
ctx = zmq.Context()
|
||
|
socket = ctx.socket(zmq.PUB)
|
||
|
|
||
|
class ps4if(Controller):
|
||
|
def __init__(self, **kwargs):
|
||
|
Controller.__init__(self, **kwargs)
|
||
|
|
||
|
def on_x_press(self):
|
||
|
socket.send_string("Hit x")
|
||
|
|
||
|
|
||
|
def main():
|
||
|
# do stuff
|
||
|
print("Hello world")
|
||
|
socket.bind("ipc:///penguinator/pubsub");
|
||
|
|
||
|
controller = ps4if(interface="/dev/input/js0",
|
||
|
connecting_using_ds4drv=False)
|
||
|
controller.listen()
|
||
|
while(True):
|
||
|
time.sleep(1)
|
||
|
|
||
|
main()
|