in reply to Code for Control Module

Stop and think about what problem you're trying to solve, what you're hoping to accomplish, and how. Then communicate your ideas to someone else, then refine your ideas (repeat this until you're satisfied with the plan). Then if your plan makes sense, write some code.