A question about Libraries

I have just got an Arduino and loving it but I am mystified by one aspect of the library

I have downloaded NewPing and hooked up an HC-SR04 and it works perfectly using this sketch taken off the internet

#include <NewPing.h>
#define TRIGGER_PIN  12
#define ECHO_PIN     11
#define MAX_DISTANCE 200

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

void setup() {

 Serial.begin(115200);
 }
 
void loop() {
  delay(50);
  int uS = sonar.ping();
  Serial.print("Ping: ");
  Serial.print(uS / US_ROUNDTRIP_CM);
  Serial.println("cm");

}

I am going to make some mods to light various leds based on distance from range finder but I am stumped by the line before last which seems to be saying divide uS by something called US_ROUNDTRIP_CM. I am not so much concerned at what it is as my inability to find out where it has come from. (I guess it is used to correct the distance to allow for the full round trip of the sonic pulse out from the range finder and back again)

I am guessing that this is defined in the Library but I cannot find out how to read the library or even if it would make sense if I could read it.

Is a Library a collection of instructions in the same style as a sketch or is it something completely different?

Many thanks to anyone who has the time to help out.

Check the directory Program Files\arduino-1.x.x\libraries\NewPing

Then open the NewPing.H with notepad for example, its all C language, there may even be other files you could open to explore in that library folder.

Shouldn't be too difficult to track down what you are looking for in one of those files, assuming that's where the library is located!

laurencekillick424: Is a Library a collection of instructions in the same style as a sketch or is it something completely different?

A library is usually written in the same language (C++) a close relative (C) or maybe assembler and can be viewed using the Arduino IDE or any text editor. If your Windows based then I recommend using a program called Notepad++ with added Arduino syntax definitions http://arduino.cc/forum/index.php/topic,112662.0.html as it makes looking at and searching large files easy.

Thank you - I feel faintly sstupid not to have tried notepad before posting teh wuestion.

Many thanks for your help