So basically, what we were trying to see is how we can use functions, how we can write functions, how we can call functions and what kind of different things we can do using the functions, the function parameters, things like that, okay, so how you can pass parameters And do the things that you want how you can make things very easy, nice and beautiful, using the function? Okay, so – and we now know how function helps when we want to write sorry, i would ah when we want to avoid writing the whole code inside the white loop, but only inside the function and we can use the function. So functions are very useful in that context. Okay, so today, right um, we can continue from where we left okay. So what we will try to do is so you know what we have been doing here right. You can do you. Do addition, subtraction multiplication right using functions. Okay, keep it aside! Uh. We will try to do one more small thing like because now, when im manually, giving the value a right, a is m and p right. So what if i give a chance to the user to have a button? Okay to have a button for each and every operation? Right so lets say we have button one that will uh. If i press it, the five lets say numbers are fixed. Sorry guys, if you press the first button, that is, that will do the addition scenario.

The second button will do this subtraction and third, but button will do the multiplication scenario, so you can think like we give three push buttons to the user and ask the user to press anyone. You want anything you want. So if you press the first push button, that is for addition, so we will return the addition value. Okay, if you press the second push button, that is for subtraction, we will return the subtraction value and if you press the third push button, you will return the multiplication value. Okay, so uh numbers lets, keep it constant like 5 and 10 for the moment, but we can give him the option of giving the addition or subtracting a multiplication choice. Okay. So since we have the push button, not the letters, he may not be able to give error income input, okay, because we are only three push buttons. So what i will do is first, i will remove this this error scenario i dont need for now. So what i will do is i will write an if condition: okay, before that, before that stringy also, we dont know we dont want because im not using their scenario now, so i stringy also, i will remove uh first, i will have three buttons and i am Going to read them, okay, so lets say the button sign, pin number two three and four okay, so im going to do three digital read scenarios digital read so first button is in pin number two its okay.

I will call this as lets say x. Lets give the number b1 that means button, one, okay or otherwise we will say b a that means uh addition button. Okay, then we will have bs subtraction button button for subtraction. So lets read that button connect the push button to pin number three okay and then bs. That means part button. Four sorry bm button for multiplication, so that is going to be pin number four, so im going to connect three buttons in three pins: digital pins. Two three: four: okay and my what so i i also want to say the pin mount of those buttons, so they are going to be input pull up. So you know those things right because we are studying enough. So if we are taking a button uh as an input or a pin for an input button, so we normally go for input, pull ups. Okay and you know what is input pull up and what other things we do with the right hand, what is the meaning of it? What is the meaning difference of the input and input pull up? You know all those things: okay, so pin mode. Two pin note 3 and pin mode 4. Are input pull up button pins? Okay, now, uh see 2 3 4 pin mode b i mentioned, and we are using the two three four pins. That means everything is clean, clear, okay, so now what i am going to do is i am going to find okay.

If the particular button is addition, button is pressed. I am going to implement this method. That means i am going to do addition and also i am going to print okay, okay, wait! So in the digital input scenario, input pull up scenario when you press a button, what is the outcome in the button state will become zero right, so you know it. So i will write an if condition: zero low. Both are same. I will say ba is zero. Okay, that means addition. Button is pressed okay, then i will open and close the if condition. Okay, what happened hold on guys. I will redo it okay. Now, if the addition button is pressed, i have to do the addition scenario. Okay and i want to print it okay, so what i will do is i will copy this and paste okay. So, if addition button is pressed, i will do the additional print. Okay, and else or i mean otherwise, the user is pressing, the other button. Okay, that means subtraction button. Okay, so else if user is pressing, the subtract send if im pronouncing correct button is zero okay. That means i have to do the subtraction operation. So, where is that that is here? Okay, so i will cut this and paste here. Okay, so addition one i will remove from here, because i dont need it. You know – because i added it here so addition is here its about subtraction, but it is pressed.

You will do the subtraction and print the value and what is the last choice? You will give another elsif to make sure the third button is pressed. So at the very moment producer can press only one button. If you press all the three button button. The first press button will be counted okay or this. This, if condition, will become true. The other else, if will be skipped. That is why im connecting everything into one male 6 chain. Okay, then i have to do the multiplication, so this is understandable, guys, nothing. I have done nothing. I just did an if else condition for a button scenario right for, because i want you – give the user to user the chance to choose the operation type addition of subtraction or multiplication for that i am giving him a button. Okay, three buttons. He can choose whatever the button he wants. Okay, this is fine, but what? If the user is pressing each and every button very quickly? First, he presses the addition button. Then he presses the subtraction button. Then he presses the multiplication button again. He press addition button something like that. So if the user is crazy, if he is doing such things, theres nothing wrong, the whatever the values will be quickly printed, okay, but we will tell the user. We will give him a chance. We cannot. We are not able to read it quickly if you process power very fast, we may not be able to read it quickly in the serial monitor.

So what we can say, the user is okay, you press the addition button, so this is the result. Wait for one! Second, after one, second, you can press the any other button option: okay, wait for one! Second, we can tell like that, okay and also if there is no no such such a delay in practical, if the users keep pressing it for a little more time again and again, this void loop will be iterating, and this value will, i mean, keep displaying.