From the course: Learning Arduino: Foundations

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Code for the pushbutton

Code for the pushbutton - Arduino Tutorial

From the course: Learning Arduino: Foundations

Start my 1-month free trial

Code for the pushbutton

- [Instructor] All right, so for coding the push button, I'm going to go ahead and open one of the examples provided by the adrenal library. So go ahead and go to file, examples and then select basics and finally digital read serial. So this is the code for a push button. So I'm going to go ahead and save it as another file because I'm going to make some changes. So file save as, and then it'll just add 10, 12 to it and then save it. So the code, it covers most of things that we've ready, went through before. So in line number 12, you can see that there's integer push button that's connected to pin two. So we need to modify that to pin 12, which is according to our wire and connection, then in the void set up, which is line 15, all the way to line 20, we have a serial begin initializing their communication between the adrenal board and the computer and the pin mode for the push button that's connected to pin 12 is…

Contents