# Analog vs Digital PINs

## Analog vs Digital PINs

In this lesson, students will learn about digital and analog values and differences.

## Target Audience

Anyone 13+ will benefit from this series. Younger audiences can still follow along when paired with an adult. An example can be a pops/grandchild STEM weekend event!

## Setup

You will need any computer with a modern internet connection. Windows, Mac, and even Chromebook will work!

And you will need an RGB LED and alligator clips.

And you need to finish the previous project from here.

## Analog vs Digital PINs

In the previous project, we connected an RGB LED and controlled it using the “digital write pin” command, and we noticed there were only two values: HIGH and LOW

In this project, we will learn more about “analog write” and the differences between “analog and digital”

after opening a new project, go to “Pins” and drag “analog write pin” and you will notice that we have many values not only “HIGH and LOW”

These values help us to change the RGB LED brightness, as 1023 in “analog” equals HIGH in “digital” so if you want to turn it on you can use 1023 (The maximum brightness)

To try different brightness, let’s try to make it 50%, half of 1023.

1023

512

To understand the “analog” values more, you can use a Loop and a variable, so you will set the starting value to 0, and increase it by 1 inside the loop.

You will notice how the LED brightness will increase one by one.

Analog and digital are methods of representing information. Analog signals are continuous and vary smoothly over time, much like a wave. Think of it like a line graph where the values can change at any point along the line. Digital signals, however, are discrete and represented using a series of binary digits (0s and 1s). It’s like using a set of switches that are either on or off to represent information. Computers, for example, use digital signals to process and store data because they can precisely represent information in a structured and efficient manner

Analog

Digital

## Then?

Try to mix colors using Analog mode, and see how many colors you can come up with!