How tom change generator frequency

You seem to be under the mistaken impression that just creating the function means it will be called. Not so. Setup() and loop() are special that way, anything else must be called from within loop(). Study the way examples are written, you will see.