Class Attribute
device_orientation: Values range from -1 to 6. To determine the logical names of these values get_logicalname API can be used with class name as DeviceOrientation.
Example
from sensor import *
import e32
class DemoApp():
def __init__(self):
self.orientation = OrientationData()
self.orientation.set_callback(data_callback=self.my_callback)
def my_callback(self):
print 'Orientation:', get_logicalname(DeviceOrientation,
self.orientation.device_orientation)
print 'Timestamp:', self.orientation.timestamp
def run(self):
self.orientation.start_listening()
if __name__ == '__main__':
d = DemoApp()
d.run()
e32.ao_sleep(10)
d.orientation.stop_listening()
print "Exiting Orientation"
See About this document... for information on suggesting changes.