Abstract: An automatic nail fastening device which is capable of adjusting the spacing and patterning of the nails is presented which is especially useful for nailing decking to a roof. The device is also capable of identifying metal having a predetermined thickness in the underlying substrate so that nailing into such metal contained in the underlying substrate can be avoided.