Playground.arduino.cc will be read-only starting December 31st, 2018. For more info pleae look at this Forum Post


Navigation


Description

This library allows you to easily do IR proximity sensing on a Circuit Playground Express. Its Github repository is here.


Download, install and import

Follow the directions here.

The library includes an example.


Creation

Proximity prox;

prox.begin(threshold);

where threshold is the threshold between close and not close.


Functions

bool close()

Returns if more IR light than the threshold was reflected.

void begin(int threshold)

Sets everything up.

void setThreshold(int threshold)

Sets the threshold once the Proximity object is declared.

int getThreshold()

Returns the current threshold.

int lastDist()

Returns the amount of IR light reflected last time close() was called.