View Single Post
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#12
Originally Posted by Radicalz38 View Post
I have just managed to play with accelerometer so here's a simple script to output the phone's state.

Code:
from ctypes import *
import os
import sys
import time
from math import atan2
from pprint import pprint

xlib = cdll.LoadLibrary("libX11.so.6")
rr = cdll.LoadLibrary("libXrandr.so.2")

def out_rotate():
    f = open("/sys/class/i2c-adapter/i2c-3/3-001d/coord", 'r' )
    cdinate = [int(w) for w in f.readline().split()]
    f.close()
    return cdinate

print out_rotate()
time.sleep(1)
Why do you load X11 libraries to read from a file and write to the console? And lots of import?