Welcome in Arduino forum,
My advice is to spend a week or so in the tutorial section to get to know the Arduino language and how to connect basic hardware. There are (I guess) all the pieces of code explained that you need for your project including tips for the connection of hardware.