Intro to Input
Table of Contents
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.