Yes, post the complete 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 code tags.
Also, we need an explanation of what " it doesn't work " means. What does the code actually do and how does that differ from what you want?
A wiring diagram may also be helpful. Written descriptions of circuits 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.