Arduino Nano 33 IoT - LED - Blink
This guide shows you how to use the Arduino Nano 33 IoT to make an LED turn on and off. It's one of the basic projects beginners start with.
Hardware Preparation
Or you can buy the following sensor kits:
1 | × | DIYables Sensor Kit (30 sensors/displays) | |
1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Overview of LED
LED Pinout
An LED has two pins.
- Cathode (-) pin: Connect this pin to the ground (0 volts).
- Anode (+) pin: Use this pin to turn the LED on or off.

How LED Works
After you connect the negative (-) side to ground:
- When you connect the power supply (VCC) to the LED's positive side, the LED lights up.
- When you connect the ground (GND) to the LED's positive side, the LED stays off.

Also, if you send a PWM signal to the anode (+), the brightness of the LED will change based on the PWM duty cycle. For more details, check the Arduino Nano 33 IoT Fade LED tutorial.
※ NOTE THAT:
- Usually, you need a resistor to keep an LED from burning out. You can put this resistor between the LED’s positive side (+) and the power supply (VCC), or between the LED’s negative side (–) and ground (GND). The correct resistor size depends on the LED's details.
- Some LEDs already have a resistor built in, so you don't need to add one for them.
Arduino Nano 33 IoT - LED
On the Arduino Nano 33 IoT, you can set the digital output pin to have a voltage of either VCC or GND. By connecting this pin to an LED, you can use a program to turn the LED on or off.
Wiring Diagram between LED and Arduino Nano 33 IoT

This image is created using Fritzing. Click to enlarge image
How To Program
- Set an Arduino Nano 33 IoT pin to work as a digital output using the pinMode() function. For example, use pin D5.
- Set the pin to ground using the digitalWrite() function to turn the LED off.
- Set the pin to VCC using the digitalWrite() function to turn on the LED.
Arduino Nano 33 IoT Code
Detailed Instructions
If you are new to the Arduino Nano 33 IoT, be sure to check out our Getting Started with Arduino Nano 33 IoT tutorial. Then, follow these steps:
- Connect the components to the Arduino Nano 33 IoT board as depicted in the diagram.
- Use a USB cable to connect the Arduino Nano 33 IoT board to your computer.
- Launch the Arduino IDE on your computer.
- Select the Arduino Nano 33 IoT board and choose its corresponding COM port.
- Copy the following code and paste it into the Arduino IDE.
- Build and send your code to the Arduino Nano 33 IoT board by clicking the Upload button in the Arduino IDE.

- See the result: The LED flashes once every second.
Line-by-line Code Explanation
The Arduino Nano 33 IoT code above explains each line. Please check the comments in the code!
※ NOTE THAT:
The code above uses the delay() function. This function makes the Arduino Nano 33 IoT stop doing other tasks. To avoid this, check out Arduino Nano 33 IoT blink without delay.