InterviewSolution
Saved Bookmarks
| 1. |
What is the difference between the INPUT and INPUT_PULLUP arguments in the pinMode() function?(a) They are both the same(b) INPUT supports only analog voltages while INPUT_PULLUP supports only digital voltage readings(c) INPUT takes the default reading as 0 while INPUT_PULLUP takes default reading as 1023(d) INPUT takes the default reading as 1023 while INPUT_PULLUP takes the default reading as 0The question was asked during an internship interview.My query is from Setting Pin Mode topic in division Arduino Programming of Arduino |
|
Answer» RIGHT option is (c) INPUT takes the default reading as 0 while INPUT_PULLUP takes default reading as 1023 To explain: The pinMode() function has 2 arguments; the pin number and the MODE. The pin number argument takes the number of the pin as input while the mode can be SET in 3 different ways, including INPUT, OUTPUT, and INPUT_PULLUP. Here the OUTPUT argument makes the pin ready for sending signals, the INPUT argument makes the pin take a voltage as input from an external SOURCE. The INPUT_PULLUP also does the same function as INPUT however only differing in the aspect of base voltage, where the INPUT argument pulls down the voltage of that port to 0V every time there is no voltage is detected across the port while the INPUT_PULLUP argument pulls up the voltage across the port to the maximum for that board whenever there is no input voltage across the port, and the reading at the port decreases with INCREASE in voltage applied across the port. |
|