forked from cfiorini/rjoystick
-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
44 lines (33 loc) · 1.52 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Now uses rb_thread_blocking_region to read events (not for sixaxis).
That way you can read events in another thread without locking up the whole RVM:
dev = Rjoystick::Device.new '/dev/input/js0'
Thread.new do
dev.event
end
which is useful when you want to build another object that
holds the current joystick state to be queried anytime.
Rjoystick - Ruby c binding to linux/joystick event
Copyright (c) 2008 Claudio Fiorini <[email protected]>
FIRST OF ALL
thanks to Ruby core developer, Linux kernel developer and
Pascal at http://www.pabr.org/sixlinux/sixlinux.en.html
and to other people...and code that help me out.
------------------------------------------------------
This is a very small code to read input/joystick information
like pressing buttons on joysticks( PS3 Sixaxis too :)! )
to get things working i used jstest as example from Vojtech Pavlik
and sixaxis patch from www.pabr.org
This Ruby extension is written in C and works only on Linux systems.
I have tested on Debian 4.0 and Ubuntu 8.04.
To install the code just run:
# ruby extconf.rb
# make
# ruby example.rb
1st example works ok with all joysticks that are good for linux.
2nd example is only for PlayStation 3(copyright Sony) Sixaxis controller
because gets 3-Axis accelerometer values and to get it works follow
this tutorial first https://help.ubuntu.com/community/Sixaxis and
you can use it in BT mode :)
Sixaxis has a gyroscope but for now you can't get values from it with
this extension...maybe in a future realease :) !!
Claudio Fiorini