Intro to Arduino

Table of Contents

  1. Intro to Output
    1. Lesson 1: Turning on an LED
    2. Lesson 2: Blinking an LED
    3. Lesson 3: Serial debugging
    4. Lesson 4: Fading an LED
    5. Lesson 5: Blinking an LED Part 2
    6. Lesson 6: RGB LEDs
    7. Lesson 7: Crossfading RGB LEDs
    8. Lesson 8: Rate Blinking Multiple LEDs
  2. Intro to Input
    1. Lesson 1: Using buttons
    2. Lesson 2: Button piano
    3. Lesson 3: Debouncing switches
    4. Lesson 4: Potentiometers
    5. Lesson 5: Force-sensitive resistors

Welcome đź‘‹ to the second module in your Physical Computing journey: Introduction to Microcontrollers (using Arduino). Here, you will learn about digital output, analog output, digital input, and analog input and build interesting musical instruments along the way from a button piano to a Jedi-force instrument! Get started with our first lesson: L1: Turning on an LED and start building! âš’đź› 

Although you can begin your learning journey here, we recommend that you complete the first module on Intro to Electronics first. This will allow you to have a more deep understanding of the content in this section, and we will occassionally refer back to Intro to Electronics.

Why this tutorial series? There are many Arduino resources online, many good, some bad. Our two favorites are, perhaps, Adafruit’s 18-Step Guide and Jeremy Blum’s Exploring Arduino: Tools and Techniques for Engineering Wizardry, 2nd Edition, Wiley, 2020. See our Resources page for more.

Our lessons are different both in approach and scope. They are based on years of experience in teaching physical computing—to design students, computer scientists, and engineers at the undergraduate and graduate level—and attempts to address common confusions head-on.

Thus, while other resources start with digital/analog input (or quickly intermix input and output), we’ve found that it’s easier to start with output. For novices, input is simply harder—it requires an understanding (or at least an awareness) of concepts like pull-down resistors, voltage dividers, and that a microcontroller reads voltages rather than current or resistance.

So, our lessons start and stick with output to solidify understanding of how to programmatically control microcontroller pins before adding in input—where the fun, of course, really starts! Moreover, most resources—at least those we are aware of—strike a different balance between depth and breadth. We love Adafruit’s tutorials but they tend towards step-by-step construction recipes rather than explaining why or how things work. As a college-level resource, we attempt to provide a deeper understanding at a cost of complexity and longer lessons. But we think it’s worth it.

Let the fun begin! 🚀🥳

The following tutorials are interactive and designed to be completed in order. All Arduino code is open source and in this GitHub repository.

Arduino Uno R3 vs. Arduino Leonardo

For this lesson series, we use two of the most popular 5V Arduino models: the Arduino Uno Rev3 and the Arduino Leonardo; however, the lessons themselves should translate to almost any Arduino board (which is the beauty of the Arduino hardware-software ecosystem!).

Image showing both the Arduino Uno and the Arduino Leonardo

Both the Uno and Leonardo have similar form factors, memory, clock speeds (16MHz), and GPIO pins (20 digital I/O pins); however, there are some differences:

  • The Uno uses the ATmega328P microcontroller while the Leonardo uses the ATmega32u4
  • The ATmega32u4 has built-in USB support whereas the Uno actually has a second microcontroller (the ATmega16U2) to provide USB communication. On the Uno, pins 0 and 1 are used to communicate with the 16u2 co-processor, which can conflict with components plugged into those pins (so our examples will often avoid using pins 0 or 1, even on the Leonardo)
  • Because the Leonardo natively supports USB, it can be mounted as a Human-Input Device and thus used as a mouse, keyboard, or joystick.
  • The Leonardo has 12 analog inputs vs. the Uno’s 6

In the lessons themselves, we’ll mark specific differences between the Uno and Leonardo, when relevant.

Intro to Output

Lesson 1: Turning on an LED

Introduces the Arduino power and ground pins, powering an initial LED circuit with a current limiting resistor, and plugging components into the Arduino.

Lesson 2: Blinking an LED

Introduces the Arduino IDE and the ability to programmatically control Arduino GPIO pins to turn an LED on and off via digitalWrite.

Lesson 3: Serial debugging

Introduces some basic debugging approaches for Arduino, with a specific focus on Serial.print.

Lesson 4: Fading an LED

Demonstrates how to gradually fade an LED on and off by using analogWrite

Lesson 5: Blinking an LED Part 2

Introduces the concept of using Arduino GPIO pins as either current sources or sinks by hooking up two LED circuit configurations: one circuit with the LED cathode towards GND and another with the LED anode towards GND.

Lesson 6: RGB LEDs

Introduces RGB LEDs, using both common anode and cathode versions, and independently controlling brightness and hue.

Lesson 7: Crossfading RGB LEDs

Shows how to fade between RGB colors using analogWrite, to use the HSL colorspace to more easily (and independently) control hue and brightness, and to use and load local C/C++ libraries

Lesson 8: Rate Blinking Multiple LEDs

In this lesson, we will learn how to blink multiple LEDs at different rates and build our first C/C++ class, which will greatly simplify our code and, as an added bonus, reduce its size by eliminating code redundancy.

Intro to Input

Lesson 1: Using buttons

Introduces buttons (aka momentary switches), digital input, using Arduino’s digitalRead function, and pull-up and pull-down resistors.

Lesson 2: Button piano

In this lesson, we are going to make a simple five-key piano with tactile buttons wired with internal pull-up resistors and a piezo buzzer.

Lesson 3: Debouncing switches

In this lesson, we’ll learn about “contact bouncing” and how to “debounce” to make our digital input more reliable.

Lesson 4: Potentiometers

This lesson introduces potentiometers and rheostats, analog input, and using Arduino’s analogRead function. Also shows how to use Tinkercad to prototype and test circuits in an online simulator and how to use a multimeter to measure current.

Lesson 5: Force-sensitive resistors

Introduces force-sensitive resistors (FSRs), how to use two-legged variable resistors with microcontrollers (including FSRs), and how to make a force-piano. Very Jedi-like!


This website was developed by Professor Jon E. Froehlich and the Makeability Lab using Just the Docs. If you found the website useful or use it in your teaching, we'd love to hear from you: jonf@cs.uw.edu. This website and all code is open source (website GitHub, Arduino GitHub, p5js GitHub). You can find the MakeabilityLab_Arduino_Library here. Found an error? File a GitHub Issue.