|
|
2010-02-26
, 15:06
|
|
Posts: 81 |
Thanked: 45 times |
Joined on Dec 2009
|
#2
|
|
|
2010-02-26
, 15:09
|
|
|
Posts: 1,559 |
Thanked: 1,786 times |
Joined on Oct 2009
@ Boston
|
#3
|
|
|
2010-02-26
, 15:15
|
|
|
Posts: 2,121 |
Thanked: 1,540 times |
Joined on Mar 2008
@ Oxford, UK
|
#4
|
|
|
2010-02-26
, 15:21
|
|
Posts: 102 |
Thanked: 22 times |
Joined on Oct 2009
|
#5
|
|
|
2010-02-26
, 15:28
|
|
|
Posts: 1,559 |
Thanked: 1,786 times |
Joined on Oct 2009
@ Boston
|
#6
|
Is there an API for reading the accelerometer? Reading /sys/class/ seems a bit low level.

|
|
2010-03-10
, 19:16
|
|
Posts: 282 |
Thanked: 337 times |
Joined on Dec 2009
@ Austin, TX, USA
|
#7
|
|
|
2010-03-11
, 14:39
|
|
|
Posts: 1,559 |
Thanked: 1,786 times |
Joined on Oct 2009
@ Boston
|
#8
|
Anyone know of anything existing like this before I reinvent the wheel?
| The Following User Says Thank You to Flandry For This Useful Post: | ||
def get_rotation(): f = open("/sys/class/i2c-adapter/i2c-3/3-001d/coord", 'r' ) coords = [int(w) for w in f.readline().split()] f.close() return coords tempA = 0 tempB = 0 action = 0 while (True): a = get_rotation() # Left and right if (a[1] + 30) > tempA and action != 1: print 'Moving left' action = 1 if (a[1] - 30) < tempA and action != 2: print 'Moving right' action = 2 # Forwards and backwards if (a[2] + 30) > tempB and action != 3: print 'Moving forward' action = 3 if (a[2] - 30) < tempB and action != 4: print 'Moving backwards' action = 4 tempA = a[1] tempB = a[2]