Use 2 arduino boards but for the same function

Hi there, I'm Fairley new to arduino and have very little experience. I'm in process of planning for a school project but have run into a situation I can't find a solution to. I'd like to know If it's possible to use 2 arduino boards but for the same function. I'm making something that involves around 10 motors and some sensors and even with an arduino mega I can only manage to get all the motors (4 of the motors are stepper motors and 6 are DC) connected before needing another board in order connect sensors however I am trying use the sensors to tell the motors what to do and so would like to only do one code instead of a code for each board although even if I take this approach how would I link the code to work together (as in how would I use sensors connected to one board to control the motors on a separate board)

Regards
Jared

Please don't hijack threads! I've had to split your post out to its own thread.

This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum section. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Jared2331:
Hi there, I'm Fairley new to arduino and have very little experience. I'm in process of planning for a school project but have run into a situation I can't find a solution to. I'd like to know If it's possible to use 2 arduino boards but for the same function. I'm making something that involves around 10 motors and some sensors and even with an arduino mega I can only manage to get all the motors (4 of the motors are stepper motors and 6 are DC) connected before needing another board in order connect sensors however I am trying use the sensors to tell the motors what to do and so would like to only do one code instead of a code for each board although even if I take this approach how would I link the code to work together (as in how would I use sensors connected to one board to control the motors on a separate board)

Regards
Jared

Have a look at the following tutorial for one method of accomplishing your goal. Master Writer/Slave Receiver

so would like to only do one code instead of a code for each board

Not only would each board need it's own code but there will be extra code for them to communicate with each other.

Another way is to use a port expander this will give you the extra pins needed and allow you to accomplish your task using only the one microcontroller.

There is also multiplexing. Although the level of difficulty would go up dramatically.

Hutkikz probably has the better solution for your situation. I gleaned over the part where you wanted to only produce one code. While not difficult to code master/slave, it is more code and multiple codes are needed.