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



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.


Proximity prox;


where threshold is the threshold between close and not close.


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.