![]() ![]() # include // includes the LiquidCrystal Library # include # define buzzer 8 # define trigPin 9 # define echoPin 10 long duration Then we need to define the buzzer and the ultrasonic sensor’s pins, define some variables needed for the program, define the keys of the keypad, as well as create the two objects for the keypad and the LCD. So we need to include the standard LiquidCrystal library for the LCD and the Keypad library which needs to be additionally installed. And at the end of this article I will post the complete source code. Next let’s see the Arduino code. As the code is a bit longer, for better understanding, I will post the source code of the program in sections with description for each section. So, for example, if we set the row 1 line low, and all column lines high, when we will press, for example, the button 3, due to the short between the two lines, the column 3 line will drop to low so in such a case we can register that the button 3 has been pressed.Īs for the other two components on this project, the ultrasonic sensor and the LCD display, you can check my previous detailed tutorials on how to connect and use them. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |