Catan RGB LED Strip Help

Hey there everyone! So today I came up with an amazing idea to make my own Catan board. If you do not know what it is, well its a board game. I decided to also be able to add buttons for each player to push so the LED changes colors depending which button is pushed.

Ex: If player Red presses his/her button then it will switch to the next color which in no order we will say is Blue just for now. Of course the next player would be set to a specific color as the example dictates for this example, I just have not decided what order the colors will be in is all.

The reason I am choosing to set each specific button the be a certain color is in case a different expansion is played where I or the other person does not have the 5-6 player addon as well; as well as to just be able to play a smaller set if need be such as a 2 player or 3 player and not just 4-6. I know it would be easy to set it so each time the button is pressed it automatically changes to the next color and you could just press it again so it skips that color but I honestly would just really like to see this idea come to play. The LED system which would be lit up will be a LED RGB Strip. I would really like to see it where if I press the button for red than only the red's side will be lit up just to indicate which side is red but if this is not do-able than I understand.

Thank you for everyone who puts in effort to help. I will be trying to build the custom board where I will be able to place road pieces into the board so they dont slip accross the board if it is nudged. Please help in anyway you think you can it would mean a lot to me and I am sure who ever else would have this idea or reads this idea and decides to build it. In attachments or somewhere on here i will try to upload an image of my idea to maybe help anyone confused.

It's not clear to me, what you want to build. Do you want to build your own Catan game board, or only an add-on, or what?

For a variable number of players, how do you want to enter the number of players? From Serial Monitor, or from switches which indicate player present/absent?

Essentially yes, "my own version of the Catan board with a small twist of adding buttons which make LED strips change colors.

There can be a total of 6 players for Catan and at times I have some people who always take so long we end up forgetting what is going on (the reason for the LED strips) and as well as people doing things when it is not there turn. All I want to do is have it so if blue player pressed the button then the lights turn blue and if red player pressed their button then it turned red. So basically 6 buttons and each button changes the color of the LED strip(s) to that persons exact color. Sorry for any confusion I was up for 2 days straight dealing with some things and typing something up the next morning at 5am wasn't helpful haha.

In short, each player has their own button and each button changes the color of the LED strips and keeps it at that color until the Arduino is either unplugged or someone else changes the color to their color using the button they possess.

Now you have described the logic so precisely, that you can start casting it in code :slight_smile:

Once it works, consider what will happen if multiple players press their buttons, at once or in sequence.

Problem for myself is I do not know code all to well sadly. I plan on learning but down the line.
I actually didnt think about that haha. If anything I actually might und up connecting specified colored LED Strips all to one battery and just have a toggle on and off button just to simplify it. "Now that I think of it" ':slight_smile:

Why not solve this the easiest way and just buy this thing? =P

But really, this project is not super difficult. You can buy a strip like this

Each of those LED's is addressable over the wire. If you look at this tutorial, you can think of it as each of these LED's having those shift register chips built in:

Except, instead of the shift register controlling whether or not the LED is on, they determine each LED's brightness using 7 bits.

So your code would consist of a function to update the strip and a function to check if your button has been pressed. I've typed up some pseudocode to get you started. I don't think my array declarations will work, and I know the shiftOut library only supports 8 bit numbers and not 7 bit (like that strip requires), so you'll probably have to write your own shift register functions unless you can find a strip with 8-bit color. I could be wrong about that, though.

int maxPlayers = 4;
int currentPlayer;
boolean prevPin = false;

byte playerColors[][] = { // Player one, red
{127, 0, 0},
// Player two, green
{0, 127, 0}
// etc, player n...
};

byte off[] = {0, 0 ,0};

setup() {
currentPlayer = 0;
illuminatePlayer(currentPlayer);
pinMode(BUTTON_PIN, INPUT_PULLUP);
}

loop() {
boolean pinValue = digitalRead(BUTTON_PIN);
if (pinValue && !prevPin) {
currentPlayer = (currentPlayer + 1) % maxPlayers;
illuminatePlayer(currentPlayer);
}
prevPin = pinValue;
}

void illuminatePlayer(int player) {
int numLedsOnSide =

// Since the number of players will change but the number of LEDs will not,
// I assume you'll want an equal number of LEDs for each player around the board.
// This ensures that. Keep in mind if you have 3 players and the board has 6 sides,
// This means that two sides will be lit up for each player.
// If you have 5 players, you will get LED's that change color along the edges since 6/5 is not rational

int numLedsPerPlayer = (numLedsOnSide * 6) / maxPlayers;

for (int i = 0; i < numLedsOnSide * 6; i++) {
if (i / numLedsPerPlayer == player) {
shiftRegisterSendColor(playerColors[player]);
} else {
shiftRegisterSendColor(off);
}
}

}

AbelCheban:
Problem for myself is I do not know code all to well sadly. I plan on learning but down the line.
I actually didnt think about that haha. If anything I actually might und up connecting specified colored LED Strips all to one battery and just have a toggle on and off button just to simplify it. "Now that I think of it" ':slight_smile:

You my friend are a life saver! Thank you! This will definitely get me started im sure I can figure out the rest from this.

Quick question why did you initiate with max 4 players? Doesn't make sense to me. Oh and the reason for not just slapping on the strip is just because of convenience of just having a button for each player. I'll be honest I am not entirely sure everyone is gonna want this but I think it would be nice to add in case we step away from the board for a second.

It's just for example. I know the original Catan game is 4 players. You can change that to 6 if it suits you.