title: Analog control Raspberry pi using pyPS4Controller
body: <p>I have a Raspberry Pi with a robotic kit and I would like to control it using a PS4 controller but using analog input. I have successfully connected the controller and I can read events and program the motors to answer binary input. The <a href="https://github.com/ArturSpirin/pyPS4Controller" rel="nofollow noreferrer">documentation (pyPS4Controller)</a>, however, is not explicit about using <strong>analog</strong> values (Ex: 50% press on R2 outputs 0.5 forward).</p>
  <p>Could someone please help me figure out how to make this?<br />
  Thanks in advance!</p>
  <pre><code># This is the example for binary buttons
  
  from pyPS4Controller.controller import Controller
  
  class MyController(Controller):
  
      def __init__(self, **kwargs):
          Controller.__init__(self, **kwargs)
  
      def on_x_press(self):
         print(&quot;Forward&quot;)
  
      def on_x_release(self):
         print(&quot;Stop&quot;)
  
  # --&gt; The objective is having some way to capture the &quot;intensity&quot; of the button press to use the motors accordingly
  
  controller = MyController(interface=&quot;/dev/input/js0&quot;, connecting_using_ds4drv=False)
  controller.listen()
  </code></pre>