3.9.2.7 class AmbientLightData

Class Attribute

Ambient_light: 0 to 100 percent light. To get the logical names use get_logicalname API with class name as TSensrvAmbientLightData.

Example

from sensor import *
import e32

class DemoApp():

    def __init__(self):

        self.ALS = AmbientLightData()

        self.ALS.set_callback(data_callback=self.my_callback)

    def my_callback(self):

        print 'ALS : ', get_logicalname(TSensrvAmbientLightData, self.ALS.ambient_light)

    def run(self):

        self.ALS.start_listening()

if __name__ == '__main__':

    d = DemoApp()

    d.run()

    e32.ao_sleep(30)

    d.ALS.stop_listening()

    print "Exiting Ambient Light"

See About this document... for information on suggesting changes.