Introduction: Switching 3 Banks of LEDs With One Switch and Visuino
This project came out of an experiment that I wanted to try, I wanted to see how much UV light was needed to see various portions of dollar bills and security checks. I had a blast building this and wanted to share these instructions here.
Things you'll need:
#1 An Arduino Nano or similar small board [even an UNO would work, just kind of big for this project]
#2 One standard sized breadboard, the 720 pin kind.
#3 3 sets of similar LEDs, each set should have the same specs, as far as Voltage and resistors required. [I used 6, 3mm UV and 3, 5mm UV for mine, but you can use any that you have on hand.]
#4 9 resistors matched to your LED current requirements.
#5 A momentary switch, either from a 37 in 1 sensor modules kit or a regular one that you can set up so it uses 3 wires.
#6 Bunch of relatively short jumper wires. [I used yellow, orange, red and black]
Step 1: Setup the LEDs and the Resistors...
In this first step, we will setup the LEDs and the Resistors. Place you LEDs a short distance from where your chosen Arduino board will be and about 1 or 2 slots from each other, to leave a comfortable space in between them. See Picture 1.
Next, place your resistors so one end is stuck in the GND rail of the breadboard and then the other is placed into the slot for the cathode pin of the LED. Reference Picture 2.
[I placed a jumper to connect the breadboards 2 GND rails together.]
Step 2: Setting Up the Wiring...
First up, for this step is to connect 2 GND wires from the Nano to the Ground rails on both sides of the breadboard. You can use a GND on either side of your chosen Arduino type board, I just used the same one for both of mine. Picture 1 & 2
Please note that the Ground rails on your breadboard may be located slightly differently.
On Picture 3 I have started plugging in the 3 different banks of LEDs into 3 Digital Pins, numbers 2, 3 and 4. Yellow wires are plugged into Pin 2 and connect to the LEDs that are the furthest away from the Nano. The Pin 3 wires are Orange and connect to the middle set of LEDs and the Red wires connect to the closest LEDs and are connected to Pin 4. Picture 4 shows the connections on the Positive side of the breadboard.
Step 3: Connecting the Switch [used for Changing the State of the LEDs]...
On my switch, in Picture 1, the Signal and the Negative are denoted on the left and the right, respectively, so the middle connection is the Positive one. The Black wire gets connected to the GND rail on the upper side of the Nano and the White wire gets plugged in the 3.3V Pin on the Nano, while the Brown wire goes into Digital Pin 10. As seen in Picture 2 and 3.
Step 4: Setting Up the Sketch in Visuino...
So, in this first Visuino Step you'll need to open Visuino or Download it from here: Visuino.com and install it per the on-screen prompts.
Next, in the main window, you'll need to select the Arduino compatible boards that you will be using for this project. Picture 1 shows that I have the Nano selected then click "OK"
Then you will want to to go to the Search box in the upper right-hand corner and type in 'but' the first part of the word, 'button' Picture 2 shows the results of this search. Drag the button component to the left of the Arduino board and space it away as shown in Picture 3.
Next, search for 'counter' in the same search box above the components sidebar, and drag the standard counter without the + and - on it, [Picture 4] to your main window just the right of the button component. See Picture 5.
Then, you are going to drag a connection wire from the Button Out to the Counter In. As shown in Picture 6.
Step 5: Setting Up the Sketch in Visuino... [continued]
In this step, we'll continue adding individual components, next up will be the decoder, so in the search box type in 'decoder' and there is only one option, in 2 different categories, Picture 1. Drag it to the right of the counter so the pins points line up, as shown in Picture 2. In Picture 3 you can see to drag a connector, from the counter to the decoder.
Now you want to add some 'output pins' to it for the different stages of the button. Change the default number to '5' in the Properties window and tap the "Enter" key on your keyboard to set it as in Picture 4. Now you can see that the pins have been added in Picture 5.
Step 6: Setting Up the Sketch in Visuino... [continued]
The next component we'll add is the OR operator, so search for 'boolean' by typing 'boo' Picture 1 and drag the OR component to the right of the decoder. Then we'll need 2 more, so drag those below the first one, as seen in Picture 2. Next, Drag a connection from Pin  of the Decoder to Pin  of OR1 Component, see Picture 3, and proceed to drag Pin  from the Decoder to Pin  of OR2 and then Pin  to Pin  of OR3, please see Picture 4.
Now you'll make the connections from the OR components to the Nano (or whichever board you are using). So, Drag connections from the Outs of the ORs to the Pins 2, 3 & 4, as seen in Picture 5.
At this stage, you have a working sketch, can you guess what it would do if you uploaded now and pressed the button?
Stop here to try out it for yourself.
See the next Step for the answer.
Step 7: Mid-Project Experiment...
So, did you test this, if you did you'd find out that the button presses turned on the LED set for each of the first 3 presses and the fourth one didn't appear to do anything, other than turn the last one off.
At the step in the project, I will explain what's happening.the Decoder has 5 positions for the button, the first one  is everything off and is the starting place. The next 3 each turn on one set of LEDs and the fifth (Output 4), that doesn't seem to do anything, at the moment, will be set up to turn them all on.
Step 8: Finishing Up in Visuino...
Now just to finish up this sketch, you'll need to complete the circuit for the ORs that we added. So, drag some connections form Pin  of the Decoder to each of the ORs Pins s, 3 of them in total. See Picture 1.
Next, connect the Input of the Button, to Pin10 on the Arduino board.(This Pin is up to you, that's just where I connected it) Pictures 2 & 3.
Picture 4 shows the completed circuit sketch and if you need/want to monitor the Serial output of the Counter then connect that output to the Serial Input as well. See Picture 5.
Step 9: Completion Video and Finished!
Now upload your sketch via the F9 Key in Visuino and then upload to the board from the Arduino IDE with CTRL+U. Then you'll have a working version of this project too.
Play around with it, to see what else you can add to enhance this sketch, then let me know in the Comments.