AW: [SHR] latest unstable with problems!

hab keen oh ne baba_melone at yahoo.de
Sun Apr 5 22:16:48 CEST 2009


Im using my own software, so I swear its not a software issue^^. Im not getting zeros, though, just very small values, that can have a negative sign, too, but do not change.




________________________________
Von: Michael Tansella <michael-tansella at gmx.de>
An: List for Openmoko community discussion <community at lists.openmoko.org>
Gesendet: Sonntag, den 5. April 2009, 21:34:08 Uhr
Betreff: Re: [SHR] latest unstable with problems!

> How do they not work? Probably you just use applications that nobody
> cares to update to handle the proper way of reporting accelerometer
> events that was announced about 2 months ago?

I used the python script from the wiki and it delivered only zeros.



#!/usr/bin/python
import struct
from math import sqrt

x = 0
y = 0
z = 0
secondsensorfile = "/dev/input/event3"
#int, int, short, short, int
fmt = 'iihhi'
#open file in binary mode
in_file = open(secondsensorfile,"rb")
event = in_file.read(16)
while event:
    (time1,time2, type, code, value) = \
        struct.unpack(fmt,event)
    time = time1 + time2 / 1000000.0

    if type == 2:
        if code == 0:
            x = value
        if code == 1:
            y = value
        if code == 2:
            z = value
    if type == 0 and code == 0:
        sum = int(sqrt(x*x + y*y + z*z))
        print x, y, z, sum
    event = in_file.read(16)
in_file.close()


_______________________________________________
Openmoko community mailing list
community at lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openmoko.org/pipermail/community/attachments/20090405/9bb98729/attachment.htm 


More information about the community mailing list