keywords in Arduino & which are built-in Keywords in Arduino

What keywords in Arduino is & what keywords do in Arduino are some questions that may arise in your mind.

Hello guys! Welcome back to another blog. Today we are going to see about keywords in Arduino so let’s begin. 

What are keywords ??

keywords in Arduino

Keywords are nothing but pre-defined words which has special meaning in programming.

here are some keywords that are mostly used in Arduino programming

  1. INPUT
  2. OUTPUT
  3. INPUT_PULLUP
  4. LED_BULTIN
  5. HIGH / LOW
  6. TRUE / FALSE
Arduino keywords list

  •   INPUT 

So first in the pin mode function, we define the mode of operation of pins, whether to enable this pin as input or output. To configure this pin we have two keywords INPUT & OUTPUT. When we configure the pin as INPUT we enable that pin to read sensor values or read a button status if the button is pressed or Not. 

In Arduino, we have 14 digital pins 0 to 13 so we can use the digital write function for digital pins only, we cannot use the digital write function for analog pins of Arduino. We usually connect the signal pin of the sensor to the digital pin of Arduino. We normally don’t use 0 & 1 pins as they are transmitter (TX) & receiver pins (RX) for serial communications. Digital input/output pins are default set as inputs and hence there is no need to declare as input initially in the pin mode inside void setup.

  •   OUTPUT 

      When we configure the pin as OUTPUT, means Arduino provide current to other circuit or devices. Examples are LEDs and motors. Digital input/output pins of Arduino are default set as inputs. 

If   We have not set pins as OUTPUT in pin Mode () and we have connected an LED to a pin, then when we call the digital Write (11, HIGH) function inside the void loop, then the LED may appear dim. So without configuring pins in pin Mode (), digital Write () enabled the internal pull-up resistor, which acts like a large current-limiting resistor.

  •   INPUT_PULLUP 

When we configure pins as input to read a button state whether the button is pressed or not, then you have noticed it is a floating pin. When the switch is not being pressed the value fluctuates between 1 and 0 i.e. high and low because of external interference. So to avoid this we use an external resistor that acts as a pull-up and pull-down resistor. If you don’t have a resistor then you don’t have to worry, this hardware configuration can be eliminated by using the INPUT_PULLUP keyword.

INPUT_PULLUP keyword is used as an argument in the pin mode function. Now the pin will be high when the button is not pressed and low when the button is pressed.

If the Arduino digital pin is configured as INPUT_PULLUP in pin mode, then it will invert the behavior of the INPUT mode, which means HIGH will acts as a button not pressed and LOW will act as a pressed. 


keywords Arduino

  •       LED_BULTIN 

Suppose you have written a code and you want to check that using a LED but the problem is that you don’t have an LED, so don’t worry you have another option you can access a built-in LED or onboard LED on your Arduino board. Arduino board has pin 13 where LED is connected. It may change for different boards. LED_BULTIN defines the number of pins where LED is connected on the Arduino board. LED_BULTIN will invert the behavior of the normal mode, which means HIGH will acts as an OFF (led will off), and LOW will act as an ON (led will on). 

  • HIGH / LOW 

Now suppose you want to turn the LED ON and turn it OFF. So to do that you have to pass a keyword argument in the digital Write function. Here keyword HIGH means giving 5v to the sensor and keyword LOW means giving 0v to the sensor. So HIGH means turning the LED on and LOW means turning the LED off.

  • true / false 

Here we have two Boolean constants true or false, we use Boolean variables for checking conditions we can define true as 1 i.e. high, and false is defined as 0 i.e. low. Also, values rather than 0 such as 2, 5, 200, etc. are considered true.


Conclusion - 

Today we learn about what is Keywords in programming, the different types of built-in Keywords in Arduino, and what operations each keyword performs helping in Arduino programming.

"I hope you find this lesson on Arduino very helpful to you and understand the different keywords used in Arduino. In the upcoming lesson, we will learn about syntax in Arduino till then bye. See you all in my next chapter of Arduino lessons." 

Close Menu