![]() switchPin is the pin to which we connected the push button.We start the code by defining three variables: 1 int switchPin = 12 The resistor now "pulls" the current to the GND. We put the resistor between the pin lower right of the push button and the GND of the Arduino. Resistor ensures that the state of the push button is really 0 Volt when the button is not pressed. Therefore, in this circuit we use a pull-down resistor. This small current can prevent the Arduino from reading the state of the push button properly. It may be that the push button does not block 100% current. The problem now is that you have a "floating" state if you don't press the button. As soon as we press the button, the 5V is connected to pin 12 and the Arduino sees this as HIGH. In principle, the push button should now be able to do all its work. The 12 on the Arduino -> the pin top right of the push button. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |