Thanks for adding functions to access the other sensors on the iPad, but I am having trouble getting data from the mag field sensor. Is some kind of calibration required? (I have the same result on both an iPad 2 and 4, both of which work with compass apps.)
For example:
import motion
motion.start_updates()
g= motion.get_gravity()
mag=motion.get_magnetic_field()
acc=motion.get_user_acceleration()
att=motion.get_attitude()
motion.stop_updates()
print g
print mag
print acc
print att
gives output:
(0.10736322402954102, -0.17101316154003143, -0.9794016480445862)
(0.0, 0.0, 0.0, -1)
(-0.0050377873703837395, -0.00197572517208755, 0.01570233143866062)
(0.10918527841567993, 0.17185789346694946, 0.004843760747462511)