What is a library, anyway?
When you want to attach sensors or other new parts (‘hardware’) to your Arduino board, it is often necessary to install a ‘library’ so that the board knows how to communicate with this new hardware. This is very much like when you plug a new printer into your computer: the required drivers or apps must be installed for it to work properly.
The NewPing library allows you to use an ultrasonic sensor, which measures distance, with your Arduino. The following instructions will guide you through downloading and installing it to your computer.
Are you a Mac user? You should check out our video tutorial on YouTube.
Step 1: Download the NewPing Library
Click the button below to download the NewPing library. A zip file should begin downloading automatically to your computer.
If you’re a user of one of our kits, you’ll find the a similar button on the relevant project pages.
Step 2: Copy the library into the Arduino software
If you’re using Microsoft Edge or Internet Explorer, you may need to confirm that you want to save the zip file to your computer. Otherwise, the file will now be saved in your ‘Downloads’ folder.
You now need to unzip the file – it should now be called something like ‘NewPing_V1.8.zip’ – and paste it into the folder in Documents > Arduino > Libraries.
The following screenshots will walk you through the process. Note that for this demonstration, we used the Google Chrome browser installed on Microsoft Windows 10. This process will be similar when using other browsers or the Mac operating system.
Step 3: Add the library in the Arduino software
You now need to tell the Arduino software that a new library called ‘NewPing’ is available. this is done by opening the Arduino software and then selecting Sketch > Include Library > Add ZIP library.
Again, we’ve included screenshots to help along the way.