Working or functionality of pinMode(), digitalWrite() and digitalRead()
{
  pinMode(kPinLed, OUTPUT);
  pinMode(kPinBtn, INPUT_PULLUP);
}


This block of code used to define mode of Pin i.e. making pin as Output pin or Input pin.

if(digitalRead(kPinBtn) == LOW)
{

}


This block of code is used to read value from defined digital pin either High or Low. And in return will give pin state High or Low. For example if we want to make LED ON which is connected to one of digital pin of Arduino at certain condition, we will define that pin under above block of code and can read state of that pin as High or Low.

 {
   digitalWrite(kPinLed, HIGH); 
 }
 else digitalWrite(kPinLed, LOW);


This block of code is used to make Pin state High or Low i.e. Under certain condition this function will make pin state either High or Low.

To learn more, visit......

PinMode Click here

DigitalRead Click here

Digital Write Click here