Difference between revisions of "7 Photosensitive gesture"

From Banana Pi Wiki
Jump to: navigation, search
Line 9: Line 9:
  
 
Its model is [https://github.com/BPI-STEAM/BPI-BIT/blob/master/doc/LightSensor-PTSMD021-0805.pdf PTSMD021] click to learn more
 
Its model is [https://github.com/BPI-STEAM/BPI-BIT/blob/master/doc/LightSensor-PTSMD021-0805.pdf PTSMD021] click to learn more
 +
 +
=Get the intensity of the light=
 +
 +
There is a light module in the firmware. We can easily get the light intensity by calling the function in this module.
 +
 +
==sample code==
 +
 +
import light
 +
from time import sleep_ms
 +
R = light.Intensity(39)
 +
L = light.Intensity(36)
 +
while True:
 +
    print('R=',R.read())
 +
    print('L=',L.read())
 +
    sleep_ms(1000)

Revision as of 17:45, 18 February 2019

Photosensitivity and gesture detection

photosensitive sensor

Careful students may have found, in the bpibit board above two such things, yes, these two things are photosensitive sensor. It is a light-sensitive sensor that, through a sampling circuit, converts the intensity of light into the magnitude of the voltage.

Bpisenser.png

Its model is PTSMD021 click to learn more

Get the intensity of the light

There is a light module in the firmware. We can easily get the light intensity by calling the function in this module.

sample code

import light
from time import sleep_ms
R = light.Intensity(39)
L = light.Intensity(36)
while True:
   print('R=',R.read())
   print('L=',L.read())
   sleep_ms(1000)