Now that your sketch has been written, let’s wire the IR proximity sensor to the Arduino and WiFi shield. The circuit will be relatively simple, and won’t require a breadboard (although you are welcome to use one if you prefer). The sensor will have three wires; connect the black or brown one to ground, the red one to the 5V power supply on the Arduino, and the white one to the analog pin you’ve specified (recall that we chose to use pin A5).
With that, you are ready for a test run. Save your sketch, upload it to your Arduino, open the serial monitor, and trigger it using the proximity sensor. Once you’re satisfied that everything is working as it should be, two small final changes will make the whole setup production-ready.
First, recall that we have been using test credentials from FedEx to build the example. To move out of testing, follow the instructions here, and replace the test credentials in your code with the production keys that you obtain (and, of course, put in the tracking number for a real package as well). Second, add a small delay to the code so that the delivery person has time to mark your package as “delivered” after depositing it on your doorstep.
Add the line
to pause for two minutes after the proximity sensor first identifies motion in the vicinity.
And that’s it! You can continue to make changes if you’d like—for example, you may want to change the delay period or add a different sort of motion sensor—but no further alterations are required. Save the sketch, upload it to your Arduino, and open the serial monitor to begin looking for deliveries!