Testhaptic - example script

Issue #62 new
mungewell created an issue

Following the same concept/format as the SDL testhaptic, please find attached a python script to do the same.

simon@bigbox:~/PySDL2-0.9.2/examples$ python testhaptic.py
Trying to find haptics
Found 0 : G27 Racing Wheel
Found 1 : Sony Computer Entertainment Wireless Controller
Using device 0
   effect 0 Sine Wave
   effect 1 Triangle
   effect 2 Sawtooth Up
   effect 3 Sawtooth Down
   effect 4 Ramp
   effect 5 Constant Force
   effect 6 Left/Right
      Bug 'leftright' not defined
Now playing effects for 5 seconds each with 1 second delay between
   Playing effect 0
   Playing effect 1
   Playing effect 2
   Playing effect 3
   Playing effect 4
   Playing effect 5
   Playing effect 6

Minor bug (in PySDL2) is that 'leftright' argument for HapticEffect is not defined.

Comments (1)

  1. Martin Egginton

    thanks for this useful script. Trying to get this to work with my G27 hardware

    I get the same output as above, but there is no response from the wheel itself. All of the id values are returned as -1.

    I checked sdl2.SDL_GetError() but it returns "Haptic error Unable to create effect"
    I also checked sdl2.SDL_HapticEffectSupported(haptic,efx[nefx]) which returns 1

    Do you have any ideas where I may be going wrong? Using PySDL2 0.9.3 and Python 2.7.6

    Many thanks in advance,

  2. Log in to comment