After putting down this project and revisiting it after several months, I solved it. No click events yet, but it wont be hard at all.
here is the BASIC code that is loaded into the microcontrollers memory:
' {$STAMP BS2}
' {$PBASIC 2.5}
x VAR Word
y VAR Word
DO
PULSIN 8, 1, x
PULSIN 7, 1, y
DEBUG LF, ? x , ? y
LOOP
And this is the python code to map the accelorometer to the mouse movements.
Requires PySerial.
from ctypes import *
import serial
s = serial.Serial('COM5') # this will be different for everyone, I used a Serial to USB cable.
user = windll.user32
x = 0
y = 0
speed = 10
while 1:
try:
d = s.readline()
d = d.split()
if int(d[2]) > 2700:
print 'right'
if x < 1400:
x += speed
elif int(d[2]) < 2400:
print 'left'
if x > 0:
x -= speed
if int(d[5]) > 2600:
print 'up'
if y > 0:
y -= speed
elif int(d[5]) < 2400:
print 'down'
if y < 900:
y += speed
user.SetCursorPos(x,y)
except: pass