How to share pins between 2 arduino's

Hello i have 2 arduino's.

On one arduino i have used up most of the pins and i am wondering if i could use my second arduino for more pins.

Yes you could but that is hard. There are easier ways to solve your problem.

Post your schematic and code. Read the forum sticky post to learn how to do this correctly.

PaulRB:
Yes you could but that is hard. There are easier ways to solve your problem.

Post your schematic and code. Read the forum sticky post to learn how to do this correctly.

thank you for responding.

would it be ok if you could add a sample code and a schematic to have an idea of whats going on in the code?

Yes, ok. You go first.

i should of mentioned it at the start because i dont want to edit my code until i know what to do and how to do it.

i also dont want to share my code because it is a big project im working on and its private

Can you share your schematic? Perhaps we can suggest ways to use the Arduino pins more efficiently, and the second Arduino will not be needed.

its basically i have a thermistor an 2x16 lcd screen 6 led's and an ir receiver. i want to add more components and sensors to my project but dont have the room.

How many pins is the LCD using? If you use an i2c backpack, you can reduce that to 2 pins, saving 4 pins (but loosing 2 analog pins, i2c uses A4 & A5).
s-l225 (9).jpg

A pcf8574 chip can drive 8 LEDs. It too uses i2c, so if your displays are also using i2c, that saves another 6 pins.
s-l225 (3).jpg

These techniques are far easier than using a second Arduino (which is a waste of an Arduino anyway).

s-l225 (3).jpg

s-l225 (9).jpg

The lcd is using 6 pins

There is your solution. Get an i2c backpack for the LCD and a pcf8574 chip or similar to drive your LEDs. Total saving of 10 pins and no need for the second Arduino. You can save that for your next project.