## Introduction: LED_Puzzle

This puzzle was created for a school project called If This Then That, I.T.T.T. when abbreviated. In this indestructible I will be guiding you though the steps I made to get to where I am now, which is a functioning puzzle made with Arduino.

For this puzzle I used 16 LED of various colors, and 6 buttons.

## Step 1: What Is This LED_Puzzle?

The puzzle consists of 16 led lights as previously mentioned. The leds are categorized into 4 rows of 4 different colors. The first color is red, then comes orange, green and lastly blue. The whole idea is that the blue leds are only turned on when the row corresponding to the button is lit. Each blue led corresponds to one row except the one, which is used to indicate the puzzle as completed. This led will only turn on when all other bleu led are lit.

To complete the puzzle you have to press the buttons to turn on the different leds in the rows. One button turns some leds on and others of within its corresponding row. You can change which within the code to make it more or less difficult as you see fit. Though I warn you, it's quite a puzzle to make it solvable.

Now to the next step, getting the materials and connecting everything to the Arduino.

## Step 2: Materials and the Setup

What you need is either quite a big breadboard or something you can solder all the resistors and leds onto.

Materials:

-16 leds (1 red, 3 orange, 5 green, 7 blue) or whatever color scheme you want.

-6 push buttons.

-22 resistors (it would be for the best if you calculate which you need for the best performance).

-an Arduino with more than 22 digital inputs.

-lots of wires (around 50 should be enough).

-a breadboard (or two if you don't want to solder the leds)

The fristzing above should give you a clear view of the setup I used.

## Step 3: The Code

The code is mostly hard-coded. I am not that good at coding yet. For the buttons you could use a debounce instead of the boolean I used for better usability. Now the buttons may not react immediately or react in a different way then anticipated.

The code (I have no idea how to implement it in a better way).

const int buttonRow1 = 2;
const int buttonRow2 = 3; const int buttonRow3 = 4; const int buttonRow4 = 6; const int buttonRow5 = 7; const int buttonRow6 = 9; const int LED_red = 51; const int LED_orange1 = 44; const int LED_orange2 = 46; const int LED_orange3 = 48; const int LED_green1 = 31; const int LED_green2 = 33; const int LED_green3 = 35; const int LED_green4 = 39; const int LED_green5 = 41; const int LED_blue1 = 27; const int LED_blue2 = 25; const int LED_blue3 = 23; const int LED_blue4 = 22; const int LED_blue5 = 34; const int LED_blue6 = 36; const int LED_blue7 = 38; bool ButtonState = false;

void setup(){ pinMode(buttonRow1,INPUT); pinMode(buttonRow2,INPUT); pinMode(buttonRow3,INPUT); pinMode(buttonRow4,INPUT); pinMode(buttonRow5,INPUT); pinMode(buttonRow6,INPUT); pinMode(LED_red,OUTPUT); pinMode(LED_orange1,OUTPUT); pinMode(LED_orange2,OUTPUT); pinMode(LED_orange3,OUTPUT); pinMode(LED_green1,OUTPUT); pinMode(LED_green2,OUTPUT); pinMode(LED_green3,OUTPUT); pinMode(LED_green4,OUTPUT); pinMode(LED_green5,OUTPUT); pinMode(LED_blue1,OUTPUT); pinMode(LED_blue2,OUTPUT); pinMode(LED_blue3,OUTPUT); pinMode(LED_blue4,OUTPUT); pinMode(LED_blue5,OUTPUT); pinMode(LED_blue6,OUTPUT); pinMode(LED_blue7,OUTPUT); }