Welcome to the forum. It is well advised to read the forum guidelines to gain some insight about how best to get help.
Basically, we need a better understanding of your setup; a sketch of your wiring will help with that. Also, it's considered good form to
- capture your code from the IDE using shift-ctrl-T
- insert in your message using ctrl-V
- and also, if relevant, to use the capture error tool the same way when advising us of errors you're seeing.
That allows us to visualize your code much more quickly, and also to transfer your code completely to our IDE software for further testing, etc.