Added tone functions to Pin.
Replaced extra code with constrain().
Fixed a tiny bug in the last commit.