2.1 Fading

This project is similar to 1.1 Hello, LED! , the difference is the signal type. The former is to make the LED light on or off by outputting a digital signal (0&1), this project is to control the brightness of the LED by outputting an analog signal.

Required Components

In this project, we need the following components.

It’s definitely convenient to buy a whole kit, here’s the link:

Name

ITEMS IN THIS KIT

LINK

3 in 1 Starter Kit

380+

3 in 1 Starter Kit

You can also buy them separately from the links below.

COMPONENT INTRODUCTION

PURCHASE LINK

SunFounder R3 Board

BUY

Breadboard

BUY

Jumper Wires

BUY

Resistor

BUY

LED

BUY

Schematic

../_images/circuit_1.1_led.png

Wiring

../_images/wiring_led1.png

Code

Note

  • You can open the file 2.1.fading.ino under the path of 3in1-kit\basic_project\2.analogWrite\2.1.fading.

  • Or copy this code into Arduino IDE.

  • Or upload the code through the Arduino Web Editor.

After the code is uploaded successfully, you can see the LED breathing.