Skip to content

Latest commit

 

History

History
79 lines (51 loc) · 4.81 KB

File metadata and controls

79 lines (51 loc) · 4.81 KB
layout default
title Output
description Learn to control Arduino's GPIO pins to drive LEDs, fade them with PWM (analogWrite), play tones on a piezo buzzer, debug with Serial, and write your first C++ class.
parent Intro to Arduino
nav_order 1
has_toc false
has_children true
comments true
usetocbot true

Intro to Output

{: .no_toc }

Table of Contents

{: .no_toc .text-delta }

  1. TOC {:toc}

In this lesson series, you will learn how to programmatically control Arduino's GPIO pins to drive LEDs, produce colors with RGB LEDs, generate tones with piezo buzzers, and build your first C++ class. We start with the basics—powering an LED from Arduino's supply pins—and progressively introduce digital output (digitalWrite), debugging with Serial.print, analog output (analogWrite and PWM), sound generation (tone), current sourcing vs. sinking, and multi-rate blinking without delay().

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

{: .note }

Before starting, make sure you have the Arduino IDE installed and have reviewed the Arduino Uno vs. Leonardo section. If you're new to electronics, we recommend completing Intro to Electronics first.

Lessons

You'll build your first LED circuit using Arduino's power and ground pins, learn about current-limiting resistors, and get hands-on experience plugging components into the Arduino.

You'll write your first Arduino program to programmatically control a GPIO pin, turning an LED on and off using digitalWrite.

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

Introduces analog output, pulse-width modulation (PWM), and demonstrates how to gradually fade an LED on and off by using analogWrite.

Explores how to generate square waves of varying frequencies to play sounds and melodies using a piezo buzzer and the tone() function.

Explores the difference between current sourcing and current sinking by hooking up two LED circuit configurations: one with the LED anode facing the I/O pin (current source) and another with the LED cathode facing the I/O pin (current sink).

Introduces RGB LEDs, using both common anode and cathode versions, and controlling color output with digitalWrite.

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.

You'll learn how to blink multiple LEDs at different rates and build your first C/C++ class, which will greatly simplify your code and reduce its size by eliminating redundancy.

What's next?

Once you've completed the Output lessons, move on to Intro to Input to learn about buttons, sensors, voltage dividers, and more!