I wrote the following code to count steps that I take:
As you can see, line 9 doesn't do anything but print a blank line, but line 14 doesn't work unless line 9 is there. What am I doing wrong?Code:1 import pyextaccel 2 import appuifw 3 import e32 4 5 def printout (x,y,z): 6 global steps 7 global high 8 accel = x * x + y * y + z * z 9 print u"" 10 if accel >= 500000: 11 if high==0: 12 steps += 1 13 steps_str = str(steps) 14 print u""+steps_str 15 high=1 16 else: 17 high=0 18 19 def quit(): 20 global running 21 running =0 22 pyextaccel.unregister() 23 appuifw.app.set_exit() 24 25 running = 1 26 steps = 0 27 appuifw.app.exit_key_handler=quit 28 while running: 29 pyextaccel.register(printout) 30 e32.ao_yield()
Also, if there is code written already for counting steps, could you link me to it?
Thanks!

Reply With Quote

