Arduino Part 1


The Arduino is a hardware and software platform used to build electronics projects. It was designed for artists, designers, and others who want to incorporate physical computing into their designs without having any prerequisite engineering knowledge.

Arduino consists of a physical programmable circuit board (often referred to as a microcontroller) and a piece of software, or IDE (Integrated Development Environment) that runs on your computer, used to write and upload computer code to the physical board.


  • It has 14 digital input/output pins (of which six can be used as PWM outputs), six analog inputs, a 16 MHz crystal oscillator, a USB connection, a power jack, and an ICSP header, and a reset button.

  • Connect it to a computer with a USB cable or power it with an AC-to-DC adapter or battery to get started.

  • Arduino code is written in C++ with an addition of special methods and functions. The Arduino Integrated Development Environment (IDE) is the main text editing program used for Arduino programming. Arduino code is referred to as SKETCHES.


They are pre-built circuit boards that fit on top of your Arduino and provide additional capabilities eg. controlling motors, connecting to the internet, providing cellular or other wireless communication, controlling an LCD screen, and much more.


  • LIBRARIES: Arduino has various built-in libraries which perform multiple functionalities. In addition, it is possible to import other libraries and expand the Arduino board's capabilities and features.


  • Setup() Every Arduino sketch must have a setup function. This function defines the initial state of the Arduino upon boot and runs only once.

    Here we'll define the following:

    1. Pin functionality using the pinMode function

    2. Initial state of pins

    3. Initialize classes

    4. Initialize variables

    5. Code logic

Setup() is also called Preparation Block.

  • loop()

    The loop function is also necessary for every Arduino sketch and executes once setup() is complete. It is the primary function; as its name hints, it runs in a loop repeatedly. The loop describes the main logic of your circuit.

    For example:

  void setup(){
     //       put your setup code here to run once:

  void loop(){

     //       put your loop code here to run repeatedly:

Other functions include:

  • pinMode(): This function sets a pin as input or an output. You pass the pin number and the INPUT or OUTPUT value as parameters.

  • digitalWrite(): This function writes a HIGH or LOW value to a digital output pin. You pass the pin number and HIGH or LOW as parameters.

  • analogWrite(): This function writes between 0 (always off) and 255 (always on) value to a analog output pin.

  • BUILT-IN CONSTANTS Arduino has various built-in functions:

    HIGH: It equates to a high level of voltage, which can differ depending on the hardware (>2V on 3.3V boards like Arduino Nano, >3V on 5V boards like Arduino Uno)

    LOW: It equates to a low level of voltage. Again, the exact value depends on the board used.

    Constants used with the pinMode() function:

    INPUT: It sets the pin as an input pin

  • OUTPUT: It sets the pin as an output pin

  • INPUT_PULLUP: It sets the pin as an internal pull-up resistor

    The other constant we have is LED_BUILTIN, which points to the number of the onboard pin. It usually equates to the number 13.

    In addition to this, we have the C/C++ constants true and false.

Below is the basic Arduino Program for "Blinking LEDs" which is somewhat analogous to "Hello World".

// Blinking LEDs  
#define LED_PIN 13

void setup() {
    // Configure pin 13 to be a digital output
    pinMode(LED_PIN, OUTPUT);

void loop() {
    // Turn on the LED
    digitalWrite(LED_PIN, HIGH);
    // Wait 1 second (1000 milliseconds)
    // Turn off the LED
    digitalWrite(LED_PIN, LOW);
    // Wait 1 second

Arduino Simulator ->

Simple LED Blinking Project

void setup() {
 Serial.begin(9600); // Initialize serial communication at 9600 bps (to computer USB)
 pinMode(7, OUTPUT); // To tell arduino that send data to this port

void loop(){ // run repetedly 
  digitalWrite(7, HIGH);  // turn to 5v or on
  delay(500); // wait for 500 milli-second
  digitalWrite(7, LOW); // turn to 0v or off
  delay(500); // wait for 500 milli-second

One wire is connected to Digital Pin 7 and other wire is connected to Ground Power Pin (GND).

Built-in Functions and Constants Resources


~ -> If you see this symbol before the pin. It means that the pin supports PWM (Pulse-width Modulation). This pin supports digital as well as analog.