Use the proximity sensor in your smartphone and take a certain action if something or someone gets near your
This shield is one of the sensor shields. Sensor shields allows you to tap into your smartphone’s sensors and use in prototyping with Arduino, you can get information from the surrounding environment and use
it to trigger a certain action.Learn more from the sensor shields tutorial.
Proximity sensor allows your Arduino to check if there’s an object interrupted the sensor and take certain actions.
Adding #define CUSTOM_SETTINGS along with #define INCLUDE_PROXIMITY_SENSOR_SHIELD is a key that will let you unlock proximity sensor shield only among all shields, preventing 1Sheeld library from eating your memory especially for UNO board.
Gets value of smarpthone’s proximity.
Note: Values of proximity doesn’t come as centimeters readings,it just comes as a 1 or 0 as a state of yes or no condition if the proximity sensor was interrupted or not, most of the phones sense if only an object gets near the proximity sensor just to turn of the display and touch so it won’t make random actions, a byte is returned as there are phones sense distance varries from each other some sense at 1cm others at 5cm, so it depends on the phones manufacturer(like calling and getting the phone near your ear the phone turn off the touch and display).
Returns a byte holding the distance the proximity sensor senses the interrupt.
byte prox = Proximity.getValue();
Sets a certain individual function written by the user in the sketch to be called and runs its functionality once an object interrupts the proximity sensor and sent by the application to the Arduino.
&userFunctionName: takes the physical address of the userFunction in the memory and jump to it once called to execute it’s functionality.
/* myFunction exists under the loop function. */
/* This function will be invoked each time an object interrupts the sensor. */
void myFunction(byte proximitySense)
/* Turn on the LED. */