Tone

Can anybody tell me how to use the tone library and about the codes and programming of it.

You mean the [u]tone()[/u] function?

The tone() function is fairly straightforward. [u]Here[/u] is an example that plays a tune through a piezo speaker connected to pin 8. Or, you can connect your powered computer speakers.

The comments say "8-Ohm speaker", but you should not connect a regular speaker directly unless you add a series resistor. Anything less than 125 Ohms will result in excessive current that can damage the Arduino.