|pinMode( x, y );|
|x = pin name or pin number that we want to define as INPUT or OUTPUT|
|y = INPUT / OUTPUT|
|digitalWrite( x, y );|
|x = pin name or pin number to where we want to write a HIGH (1) or LOW (0) value|
|y = HIGH / LOW|
pinMode();if the pin is configured as OUTPUT, with
digitalWrite();we can set corresponding values (either HIGH or LOW).
|pinMode( x );|
|x = pin name or pin number from where we want to read a digital (1/0) value|
|Return: HIGH / LOW|
pinMode();first the pin is configured as INPUT. Then with
digitalRead();function we can read values (HIGH or LOW) from a specified pin.
digitalRead();can give us wrong result (either HIGH or LOW). So by default we should connect it to a known voltage (+5V for HIGH or GND for LOW) to avoid any confusion.