APDS9930 Digital Proximity and Ambient Light Sensor package
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
demo.jpg
demo1.jpg
demo2.jpg
icon.png
main.ts
pxt.json
test1.ts
test2.ts

README.md

APDS9930

APDS9930 Digital Proximity and Ambient Light Sensor package

Author: shaoziyang
Date: 2018.Apr

Usage

open your microbit makecode project, in Add Package, paste

https://github.com/microbit-makecode-packages/APDS9930

to search box then search.

API

  • init()
    Initialize APDS9930, enable ALS and power.

  • getALS()
    get Ambient Light Sensor

  • getProximity()
    get Proximity data.

  • ALSEnable(en: boolean = true)
    Enable/Disable ALS feature.

  • ProximityEnable(en: boolean = true)
    Enable/Disable Proximity feature. Please note that VL must link to VCC when using proximity feature.

  • PowerOn()
    Set PON bit, enable all feature.

  • PowerOff()
    Clear PON bit, disable all feature.

  • AGAIN(gain: APDS9930_AGAIN)
    set ALS Gain.
    gain is:

    • AGAIN_1, 1
    • AGAIN_8, 8
    • AGAIN_16, 16
    • AGAIN_120, 120
  • PGAIN(gain: APDS9930_PGAIN)
    set Proximity Gain.
    gain is:

    • PGAIN_1, 1
    • PGAIN_2, 2
    • PGAIN_4, 4
    • PGAIN_8, 8

Demo

demo1

demo2

License

MIT

Copyright (c) 2018, microbit/micropython Chinese community

Supported targets

  • for PXT/microbit

[From microbit/micropython Chinese community](http://www.micropython.org.cn