Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # XYZirkle.py
- import appuifw
- import sensor
- xyz=(0,0,0)
- def draw(rect):
- canvas.clear(0x000000)
- point_size = (xyz[2]*6)-400
- point_x = (-xyz[0]+60) * canvas.size[0] / 120
- point_y = (xyz[1]+60) * canvas.size[1] / 120
- point = (point_x, point_y)
- canvas.point(point,outline=0xffffff,width=point_size,fill=0xffffff)
- def redraw():
- global xyz
- xyz=(sens.x,sens.y,sens.z)
- draw(canvas.size)
- appuifw.app.orientation='portrait'
- appuifw.app.title=u'XYZirkle'
- appuifw.app.directional_pad=False
- canvas=appuifw.Canvas(redraw_callback=draw)
- appuifw.app.body=canvas
- sens=sensor.AccelerometerXYZAxisData(data_filter=sensor.LowPassFilter())
- sens.set_callback(data_callback=redraw)
- sens.start_listening()
- def forLight():
- appuifw.e32.reset_inactivity()
- timer.after(10,forLight)
- def exit():
- app_lock.signal()
- appuifw.app.exit_key_handler=exit
- timer=appuifw.e32.Ao_timer()
- forLight()
- app_lock=appuifw.e32.Ao_lock()
- app_lock.wait()
- sens.stop_listening()
- timer.cancel()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement