EPx professional blog and repository for braindumps

2009/08/24

Playing with accelerometer sensors in Python for Series 60

I was preparing some code snippets for the upcoming PythonBrasil event and the PyS60 course. I had written an example for sensors (accelerometer and tilt), but I realized that dumping sensor numeric data on console is difficult to interpret, in particular because the XYZ axis are relative to the cell phone rather than absolute in space (the thing does not have a gyroscope within, after all).

Rainy Saturday nights are really inspiring. I began to tweak the original accelerometer/tilt sensor example, trying to make the output more interesting and meaningful. Here is the result:



As I say in video, tilt sensor precision is fifteen degrees, so the N85 is still not good enough to drive my ICBM missile into North Korea or Cuba :) The accelerometer is more fine-grained: it returns an integer value around 60 for gravity, and it never goes up 119 in absolute value, which suggests it has a 1/60g resolution and +/-2g range.

Code can be found at http://epx.com.br/artigos/snippets.

0 comentários:

Postar um comentário