Table of Contents

Understanding Arduino Digital and Analog Pins

Example Description
Learn about Arduino digital and analog pins and their functions as input or output for voltage levels.

Introduction

Digital pins

Arduino’s digital pins offer two voltage levels: HIGH (5V) or LOW (0V). When set to LOW, a pin provides 0V to external devices, while setting it to HIGH delivers 5V, enabling triggering of relays or LED illumination. Additionally, digital pins can function as input to read data from peripheral devices or as output to power sensors and other devices. On the other hand, analog pins are used to read analog values in the form of voltage levels ranging from 0V to 5V.

Analog pins

These are the pins that are used to read the analog values from devices in the form of voltage levels between 0v to 5v

Circuit Diagram

  1.  Resistance = 220Ω
  2. LED+ to pin 13 
  3. LED – to GND

Code

Now let’s connect our Arduino to Pictoblox and learn to code. 

  1. Open Pictoblox and choose Block coding.
  2. Go to “boards” and select “Arduino Uno” from the list
  3. From “connect,” choose the serial port, and then click on the “connect” button to establish the connection between Arduino Uno and your computer..
  4. Click on the event palette and drag “when the flag clicked.”
  5. From the control palette, drag the “forever” block and add it to the event block.
  6. From the Arduino palette, drag “set digital pin() output as ()” block into the forever block.
  7. Again from the control palette add the wait() block  into the forever block
  8. Repeat steps 6 and 7, setting the output as LOW this time.

Script

Output