NewPing Library: HC-SR04, SRF05, SRF06, DYP-ME007, Parallax PING))) - v1.7

notsoyyo:
Hi,

First of all THANK YOU TIM for this library!!!!!!!!!!!!!!!!!!!!
And thank you to all the enthusiasts who have been posting here!

I have been running into a slight problem that I have not been able to fix, despite dowloading the lib again, googling it a million times, etc. I am trying to get readings from a PING))) sensor and from a maxbotic MAX SONAR (which can be PWM, An or BW, I have it as PWM) and arduino throws the same error:
'NewPing' does not name a type

sketch_jan06a:3: error: 'NewPing' does not name a type
sketch_jan06a:4: error: 'NewPing' does not name a type
sketch_jan06a.cpp: In function 'void loop()':
sketch_jan06a:19: error: 'sonar1' was not declared in this scope
sketch_jan06a:23: error: 'sonar2' was not declared in this scope

Any suggestions would be greatly greatly appreciated..... Thank you!!!!!

Your exact sketch compiled fine here. But, I can get it to fail and give the above errors by removing the #include <NewPing.h> line. This means that while you're telling it to load NewPing.h, it can't find it. Most of the time, this means that you didn't install NewPing properly to the correct directory. Libraries are installed inside your "Arduino" library in a subdirectory named "libraries". Inside "libraries" you would create a new directory named "NewPing" with the files in the NewPing zip file in the NewPing directory. See the other directories inside "libraries" for examples of how it should look. The only instructions I have for installing a library with Arduino is:

Put the "NewPing" folder in "libraries".

If you can't figure out how to correctly install a library, do a web search for how to install an Arduino library, maybe someone else has a better way of describing it.

Tim