Thanks, this worked like a charm. For reference, the code I used is below. Thanks for all your help!
PHP Code:
# Manual: "Support is device dependent, e.g. Nokia 5500 supports # OrientationEventFilter
#and Nokia N95 supports RotEventFilter"
import sensor, appuifw, e32, graphics, sysinfo
from key_codes import *
# no idea what this line does
app_lock = e32.Ao_lock()
'''Define the exit function'''
def quit():
app_lock.signal()
appuifw.app.exit_key_handler = quit
'''Initialization'''
appuifw.app.screen = 'full'
screen_w, screen_h = sysinfo.display_pixels()
xAxisData = yAxisData = zAxisData = 0
'''Returns the dictionary of available sensors '''
sensors = sensor.sensors()
blank = graphics.Image.open('C:\\Data\\Images\\Pictures\\blankscreen.gif')
duke = graphics.Image.open('C:\\Data\\Images\\Pictures\\duke_logo.gif')
def handle_sensor_raw(a_data):
''' What happens when a sensor event is received '''
global xAxisData, yAxisData, zAxisData
yAxisData = a_data['data_1']
xAxisData = a_data['data_2']
zAxisData = a_data['data_3']
handle_redraw(())
#print 'X-Axis: ', xAxisData
#print 'Y-Axis: ', yAxisData
#print 'Z-Axis: ', zAxisData
def handle_redraw(rect):
# Clear canvas
#c.clear()
blank.clear()
# Write text
blank.text((screen_w/10, screen_h - screen_h / 2 - 30), u'x-Axis: '+str(xAxisData), 0x0080000, font='title')
blank.text((screen_w/10, screen_h - screen_h / 2 - 10), u'y-Axis: '+str(yAxisData), 0x0080000, font='title')
blank.text((screen_w/10, screen_h - screen_h / 2 + 10), u'z-Axis: '+str(zAxisData), 0x0080000, font='title')
# Write Logo and blank
blank.blit(duke, target=(0,200))
c.blit(blank)
# Does this device have Accelerator Sensor? If so, set it up.
if sensors.has_key('AccSensor'):
SENSOR_ACC = True
sensor_data = sensors['AccSensor']
sensor_acc = sensor.Sensor(sensor_data['id'], sensor_data['category'])
#sensor_acc.set_event_filter(sensor.OrientationEventFilter())
# should probably add some sort of event filter here
sensor_acc.connect(handle_sensor_raw)
# Create instance of Canvas and set it up
c = appuifw.Canvas(redraw_callback=handle_redraw)
appuifw.app.body = c
# Wait for user to request exit
app_lock.wait()
# turn off sensor to save power
sensor_acc.disconnect()