(deleted)
I was new to Arduino not soo long ago.
Devide Your project into smaller pieces and make sure You can control the pieces, one at the time. Than You can integrate the functioning pieces, one by one, into Your system.
(deleted)
I have taken to using two arduinos for development of system like this. I use the first arduino to figure out how to get one module working. Then add the module and the code to the second arduino. The first arduino is just to figure out how to get one module to work the second is additive to get the first and second modules to work, then first, second and third and so on.
The arduinos never talk to each other, the first is the development platform for a single module, the second arduino is the final system.
In the end I have one sketch per module plus one sketch with ALL the modules.
Planning and Implementing a Program may give some ideas about organizing your code.
...R
One step along the way is assigning pins. In most cases, pins can only be use for one task in a program. To make the sketch easier to understand (and change) you should assign meaningful names to the pins. That is best done with a "const byte" variable at the top of your sketch. I like to put the declarations in pin-number order since it makes it easier to see if you accidentally assigned the pin to multiple uses!
// Pin Assignments (Digital)
/*0*/ // This is the Serial RX pin. Don't use it if you use Serial
/*1*/ // This is the Serial TX pin. Don't use it if you use Serial
const byte DescriptiveNamePin = 2; // Example of how to assign a name to a pin number
.
.
.
/*10*/ // SPI hardware Slave Select. Don't use as INPUT if you use SPI (Ethernet, WiFi, SD Card, etc)
/*11*/ // SPI hardware MOSI. Don't use if you use SPI (Ethernet, WiFi, SD Card, etc)
/*12*/ // SPI hardware MISO. Don't use if you use SPI (Ethernet, WiFi, SD Card, etc)
/*13*/ // SPI hardware Clock. Don't use if you use SPI (Ethernet, WiFi, SD Card, etc)
// Pin Assignments (Analog Inputs)
const byte DescriptiveNameAnalogPin = A0; // Assign a descriptive name to an analog pin name
.
.
.
/*A4*/ // WIRE/TWI/I2C bus clock. Don't use for Analog Input if you need the bus (RTC, etc)
/*A5*/ // WIRE/TWI/I2C bus data. Don't use for Analog Input if you need the bus (RTC, etc)