Freerunner games / using motion sensors in C

Andy Green andy at openmoko.com
Tue May 13 09:01:45 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Somebody in the thread at some point said:

| If somebody tells me how to use the accelerometers, I will have a go. Is
| it just like /dev/joydev ?

You just open /dev/input/event2 (top accel) and/or 3 (bottom).  Have a
look in <cross path>/usr/include/linux/input.h -- basically these guys
turn up in there 300 a second:

struct input_event {
	struct timeval time;
	__u16 type;    <==== type = 2
	__u16 code;    <==== code = 0=X, 1=Y, 2=Z
	__s32 value;   <==== signed mG force in 18mG steps
};

- -Andy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkgpPNkACgkQOjLpvpq7dMoVuwCfVbgX9PEmkWvsnK8ju7RwzwR5
ilgAn2tDzszlCky4+Vq7d10iiWqB9A5B
=GNI5
-----END PGP SIGNATURE-----




More information about the community mailing list