[ANN] Joysticks.jl Version 0.1.3

Joystick interface for Julia

This is the first version that is cross-platform and tested on Windows and Linux.
It should also work on Mac, but I cannot test that (voluteers welcome).

Compared to using the bare Joystick driver from GLFW.jl it has the following advantages:

  • a deadzone was added to make sure you get zero output in neutral position
  • the buttons are connected to observables from Observable.jl which makes it very
    easy to call a function when a button is pressed and/or released.

Basic usage

using Joysticks, Observables

const js        = open_joystick()
const jsaxes    = JSState()
const jsbuttons = JSButtonState()

async_read!(js, jsaxes, jsbuttons)

on(jsbuttons.btn1) do val
    if val println("Button 1 pressed!") end
end
on(jsbuttons.btn2) do val
    if ! val println("Button 2 released!") end
end

while true
    println(jsaxes)
    sleep(0.05)
end

I tested it on Windows and Linux and it works for me, but probably not for
every configuration, so if you could test it and give feedback that would
be nice.

Thanks a lot to the community for the support and thanks to José Joaquín Zubieta Rico
for the initial implementation. :slight_smile:

5 Likes