Under the Magic Lid of evive there are 28 Digital 5V Input and Output (I/O) pins. By digital, we mean that there will be only 2 states the digital pin can have, either HIGH (5V or 3.3V) or LOW (0V/GND).
A digital output allows you to control a voltage with evive. If evive instructs the output to be high, the output will produce a voltage (generally about 5 or 3.3 volts). If evive instructs the output to be low, it is connected to ground and produces no voltage.
Let us consider an example, evive has a LED (named Pin 13) whose positive terminal is connected internally to digital pin 13 and negative terminal is connected to GND. There is a resistor also present between the digital pin 13 and positive terminal of LED to prevent excess current flow through LED (Excess current makes LED faulty).
LEDs are like tiny lightbulbs. However, LEDs require a lot less power to light up by comparison. They’re also more energy efficient, so they don’t tend to get hot like conventional lightbulbs do.
The positive side of the LED is called the “anode” and is marked by having a longer “lead,” or leg. The other, negative side of the LED is called the “cathode.” Current flows from the anode to the cathode and never the opposite direction. A reversed LED can keep an entire circuit from operating properly by blocking current flow.
Now when digital pin 13 is HIGH, current passes though LED and it starts glowing. When digital pin 13 is LOW, there is no current passing through LED. Hence, it does not glow. Now all you have to do to control the LED is simply control the digital pin 13.
Every digital pin you use should be configured as OUTPUT inside the setup() loop. This is done using the following statement:
where the pin is the digital pin number you want to initialise as output.
Note: These pins are also in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can source (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This is enough current to brightly light up an LED.
Using digitalWrite() function in Arduino IDE, you can write a digital pin, to a HIGH or LOW value.
Now you know, how to use digital pin as OUTPUT, let us write LED blinking sketch in Arduino IDE. In this sketch, we will turn ON the LED for 1 second, then turn it OFF for another 1 second and repeat. Given below is the Arduino sketch: