Note in advance: nothing is urgent.
May we assume that your sketch runs correctly when powered over USB?
What is the 9V source? A PP3 battery? Those are quite useless in general as they can't deliver the needed current, especially if you have anything more connected than a simple button.
Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project
See About the Installation & Troubleshooting category.