Adapting Code

Hello,

So i've been trying to figure out a project as of late and I don't have that much programming knowledge, I'm in computer science 1 at my university right now. Either way, I'm trying to figure out how to have a code adapt to a plug and play board. Its pretty basic, I'm just confused on how the mainboard would be able to sense that a new board had been plugged into it. like, how would it constantly check the pins that are open to see if there are things plugged into them and then adapt the code? To give you and idea of what I want to do is i want it to adapt LED arrays to their new size when I plug the new boards in.

What kind of command could I use? What piece of code would I need to have it constantly check the pins and how would it go? I'm really confused.

Your question is kind of vague, but here is one way to determine if "something" is connected.

There isn't a direct command to ask "is this pin open." Unconnected pins are floating and so it isn't possible to tell if they are high or low, their value is always random.

One option would be to use a single pin and an indicator. Turn on the I/O pin's internal pull-up resistor. On the board (or whatever) is being "connected", have that pin connected to GND. Then your code just checks the "id pin" to see if it is high or low.

To give you and idea of what I want to do is i want it to adapt LED arrays to their new size when I plug the new boards in.

I hope you don't mean to do this while the Arduino is running.

I want to have arrays of LED's and then connect them whenever. Yes, while the arduino is running. I know how to set it up in a way that will deal with the all the power issues. It won't burn out, its just i need a code that can recognize that a new led array has been added on to the mainboard.

The first board I want to be connected through the TX pin and then whatever power pins that will be needed and each board thereafter will have another "TX" pinhole that will just transmit the same data over to the next one. I just need something that I can put all around the could that would be used for the mainboard that can adapt the output parameters.

Like extending the display across 2 boards if another is plugged in, otherwise it'll jsut be on the mainboard. without any human saying aw i plugged another one in arduino.

Is there anything like that?