154k views
1 vote
What will be the correct syntax to make a digital pin (say D2) as an output pin?

1) pinMode(2,output)
2) pinMode(2,Output)
3) pinMode(2,OUTPUT)
4) pinMode(2,OUTPUT)

1 Answer

3 votes

Final answer:

The correct syntax to make a digital pin (say D2) as an output pin in arduino is pinMode(2, OUTPUT).

Step-by-step explanation:

The correct syntax to make a digital pin (say D2) as an output pin in arduino is pinMode(2, OUTPUT).

The pinMode() function is used to configure the specified pin as either an input or an output. The first parameter specifies the pin number, and the second parameter specifies the mode.

In this case, 2 represents the digital pin D2, and OUTPUT tells the Arduino that the pin should be configured as an output.

User Emily Beth
by
8.1k points