 One of the most frustrating things about working with an Arduino such as this one or any microcontroller is that whenever you have to make a very small change in the code or in any information that's stored on the board, you have to plug it into your computer with this blue cable, change it, upload it back, and hope that everything goes well. It's not a super realistic thing to do. You have a microwave, you click the buttons, you click enter, you click start, you're good to go, you want to make a change, you click restart, you put a number again and you go Unfortunately, microcontrollers do not work like a microwave. But the nice thing is we can add different components to this and make it work the way we want. In the passable project, I showed you guys different parts of a water system, how to stop water, how to move it from one place to another, how to read pressure, how to read flow, and how to display everything on a nice resolution screen. But what if you want to change something? For example, the pump turns on for five seconds and turns off for five seconds. What if you want to make it two and two? Currently, we would have to plug it into the computer with the blue cable, change the number, upload it to the board and hope everything worked. Something as simple as changing one number, it can take another minute, minute and a half and you're constantly adjusting these things. So it adds up over a day. And that's where this comes in. This right here is a universal four key push button switch module for Arduino. Yeah, that's a long name. But all it does is have these super simple four switches here, connect them all together so that they're only using five pins. And then you can wire that to whatever you're using. The nice thing about these switches is they're super simple. All you got to do is push them and they close the circuit. And that's it electricity flows through my goal today would be to use this to adjust some of the parameters in our recent projects. So if I want pump on for five seconds, instead of two, I want to be able to click left and right to go up and down and then maybe another button to enter. Or if I want to change some information for a motor, and then I want to go to a pump and change for that. And then I want to go to a sensor and change for that. I want to be able to cycle through some information. So let's make a quick little demo. Let's start with the wiring and then we'll get to the code for the demo. All you're going to need is your Arduino, some cables and your universal four pin switch, big name, whatever it is. When it comes to wiring this up, it's super simple. It has five pins on the back, four for the switches and one for ground. First off, I'm just going to grab a cable, plug it to ground on this. And then I'm going to plug that into the ground on the Arduino board. Then I'm going to plug in each one of my pins from the switch panel to the Arduino, starting with two for the first one and then going three, four, five for the others. So switch number one goes into pin number two, switch number two goes into pin number three, switch number three goes into pin number four and switch number four goes into pin number five. That's it for connecting your universal four switch panel to an Arduino. Then we're going to plug in the Arduino into the computer. One thing I want to mention is we're not going to use this like a normal switch. Since we're not blocking power between one thing to another, so we're not blocking, let's say, a power supply to a pump and then we would push it, it opens up the pump. We're using this almost like a info input, like an up, down, left, right. What we're going to do is we're going to power each one of these switches and because they're closed, power is not going to flow through all the way to the other side and we can read that. But if we open up one of the switches, they're going to ground and then the power level is going to drop drastically because it's being grounded and then we're going to know that that switch is open. So think of it as right now, all the switches have power and when there's an absence of power, we know that the person is clicking on that switch and we're going to use the technique that we used before, which is a pull up resistor on the pins for the switches. The code itself should be pretty simple. We're going to start with our variable declarations at the top. After that, we're going to do two different counters and we're going to set those both to zero. One counter is going to count for our number, let's say seconds on a pump and then the second one is going to be a text index. What this is going to do is when we put an array with some devices like let's say motor, solenoid 1, solenoid 2 and we cycle through them then whatever we put for the counter will be equal to that motor, that solenoid or whatever it is. So for example, let's say we're selecting motor and then we go here and we put motor equal to four. So now we know motor will run for four seconds and we can do all that from our little button switch panel here instead of doing it in the code. So put that back to zero and then go to setup and put two big things. First, your input pull up for all the pin modes. So one, two, three, four, two, three, four, five. That's where we plugged everything in. Then next up, we're going to say serial dot begin to open up the serial modder so we can see what kind of things we're inputting into the Arduino. Then we're going to go straight into the loop and we're going to start doing a couple different things. For the first two pins, we're going to bring the counter up or down depending on which one you press. So the left one, so pin number one, will bring up and then the other one will bring it down. You can see we say when digital read button pin one equals low so there's no power, there's absence of power. Run this code which is just add one number to our counter and then a delay as a simple debounce. Then here you can see we're doing the same thing but we're removing from that counter one. Then we're going to do the same thing for the next two pins but we're going to do up and down increments on our string here or sorry on our array here which has motor solenoid one, solenoid two. This is just an example of what you can be controlling and then you can play with this way more. Then at the bottom as always I want to print out what we're doing which is going to be our counter and our index. Then at the bottom as always I want to print out what we're doing which is our counter and our text index and then start the loop again. So we declare our inputs, we make a counter for both counter and index and then we write our index or array. Then we declare all those as pin mode input pull up, open up a serial monitor, our loop here says up one, down one and then this one is pretty much left and then right. Alright so we plugged in our board, let's select it up here, let's upload the code and then go in your tools and go down to serial monitor wherever it is and then clear this out. So now you can see counter is zero and text is motor but what if I go and I click the first button. Now we can see counter goes to one, if I click it again counter goes to two, if I click it a couple more times you're going to see it starts climbing up seven, eight, nine, ten, eleven, twelve. Now if I click button number two that should go back down so currently we're at 15 and bring it down to 14, bring it down to 13, 12, 11, 10, 9, 8, 7 and keep going down until at zero and if I click again it should go negative one. Put it back to zero. Now I'm going to switch and I'm going to go to the next thing. So currently we're on motor, let's go on button number four, now we're on solenoid number one. Click it again, we're on solenoid number two then click the third button, we go back to one and we go back to motor. This is a good example on how you can control your code with an input instead of having to upload it through the computer and do that whole process over and over again. I mean watch the difference. I want to click on this input pad once to change the counter from zero to one. Now look how long it's going to take me if this was a project. One, two, three, four, five, six, oh it crashed seven. I don't know where we're at now, 10. Upload it to the board. What 15, 20 seconds because I made an error maybe 10 seconds if I don't make an error versus what? A split second by just clicking up and down. So using inputs on your projects is super, super, super useful and we're definitely going to be using a lot of these. One thing I would love to do in a future video is actually connect my phone to my Arduino because there are Wi-Fi and Bluetooth Arduino modules and then use my phone to control everything so I can actually go on my phone and type in the numbers and make adjustments all from my phone without plugging it in physically. Just everything over Wi-Fi or over Bluetooth. So now using our switch panel we can click up a bunch of times and then down a bunch of times and make adjustments on the fly. If you enjoyed this video and you want to help me out click the subscribe button because I think about 97 to 98 percent of viewers who have been watching the past couple videos are not subscribed so they're not getting notified when I post. If you enjoyed this type of content, have any questions, want to see anything new in the future, have any specific thing you want me to review or build or whatever it is, let me know in the comment. I do read my comments a lot and we have a discord where we can help you out if you have any problems with any of the stuff you see in videos or more of a group of a couple people that are willing to help you out. I guess that's it for this one. We're getting really close to the final project of our water series. I'll see you in the next one.