Intro to Input

Table of Contents

  1. Lessons
    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
  2. What’s next?

In this lesson series, you will learn how to read digital and analog input on the Arduino using buttons, potentiometers, and force-sensitive resistors. Along the way, you’ll build musical instruments—from a button piano to a Jedi-force instrument—and learn about important concepts like pull-up resistors, debouncing, and voltage dividers.

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

Before starting, we recommend completing the Intro to Output lessons first. The Input lessons build on concepts like digitalWrite, analogWrite, and PWM covered there.

Lessons

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

You’ll make a simple five-key piano with tactile buttons wired with internal pull-up resistors and a piezo buzzer.

Lesson 3: Debouncing switches

You’ll learn about “contact bouncing” and how to “debounce” to make your digital input more reliable.

Lesson 4: Potentiometers

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!

What’s next?

Once you’ve completed the Input lessons, you’re ready for more advanced topics! Check out Communication to learn about serial communication between Arduino and your computer, or explore Advanced I/O for OLED displays, vibromotors, and input smoothing techniques.


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.

Made with ♡ by the The Makeability Lab logo which is a large geometric M with an embedded L