Your request is missing a lot of information that we need to have before we can offer intelligent assistance.
Please post the your code.
Please read the forum guidelines to see how to properly post code and some information on making a good post.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in a code block.
Please post a schematic or a wiring diagram. Written descriptions are always more ambiguous than a drawing. Hand drawn, photographed and posted is fine. Include all pin names/numbers, components, their part numbers and/or values and power supplies.
Photos of the wiring and overall project are often helpful.
Provide links to data sheets or other technical documentation for the components.