Problem relate to project

Put the 'one off' code in setup(), the main program / sketch on loop().