Build a Remote-Controlled Flashlight 🔦

In this lesson you'll build an LED flashlight and control its brightness from a webpage.

webpage

What You'll Need

  • Arduino
  • Breadboard
  • LED
  • Resistor
  • Jumper wires

LED Tip

LEDs only work in one direction.

Long leg = Positive (+) Short leg = Negative (-)

led

Breadboard Tip

A breadboard lets us connect parts without gluing them together.

Step 1: Build It

fullwire

electroblocks

closeup

Test Code

Upload this first to make sure your LED is wired correctly. If the LED turns on, your wiring works!

Coding

Using the site

1. Only one website can connect to the Arduino at a time. Close ElectroBlocks before opening the flashlight website.

2. Go here FlashLight Website and click the connect button.

3. Move the slider. Low numbers make the LED dim. High numbers make the LED bright.

Challenge ⭐

  • Can you add a second LED?
  • Can you write code to make a blinking light if you type the word "blink"
  • Can you make your own light patterns.